Home >Backend Development >PHP Tutorial >PHP quick sort problem
As shown in the picture: PHP quick method, two writing methods in the loop, the above one is OK, the following one will report errors;
Error screenshot:
As shown in the picture: PHP quick method, two writing methods in the loop, the above one is OK, the following one will report errors;
Error screenshot:
Did you think
<code>if ($v > $mid) { $rightArr[] = $v; } if ($v < $mid) { $leftArr[] = $v; }</code>
and
<code>if ($v < $mid) { $leftArr[] = $v; } else { $rightArr[] = $v; }</code>
Does it mean the same thing?
Don’t you consider the situation where $v == $mid
?