How can I solve the problem of a small number of bugs in php ?? Phpfunctionquicksort ($ str) {if (count ($ str) 1) return $ str; why are these two attempts? $ Key $ str [0]; why? $ Left_arrarray (); required bytes
Function quicksort ($ str ){
If (count ($ str) <= 1) return $ str; // just a few clicks, just a few clicks? Br/> $ key = $ str [0]; // Please refer to the €? Br/> $ left_arr = array ();
$ Right_arr = array ();
For ($ I = 1; $ I If ($ str [$ I] <= $ key)
$ Left_arr [] = $ str [$ I];
Else
$ Right_arr [] = $ str [$ I];
}
$ Left_arr = quicksort ($ left_arr); // does the specified parameter have been created? Br/> $ right_arr = quicksort ($ right_arr );
Return array_merge ($ left_arr, array ($ key), $ right_arr); // you can find the desired version.
} // Why? Br/> $ str = array (, 0 );
Print_r (quicksort ($ str ));
?>
Technical technical support
Function bubbingSort (array $ array)
{
For ($ I = 0, $ len = count ($ array)-1; $ I <$ len; ++ $ I)
{
For ($ j = $ len; $ j> $ I; -- $ j)
{
If ($ array [$ j] <$ array [$ j-1])
{
$ Temp = $ array [$ j];
$ Array [$ j] = $ array [$ j-1];
$ Array [$ j-1] = $ temp;
}
}
}
Return $ array;
}
Print'
';
print_r(bubbingSort(array(1,4,22,5,7,6,9)));
print '
';
Why? Php function quicksort ($ str) {if (count ($ str) = 1) return $ str; // why is it true? $ Key = $ str [0]; // Please refer to the following link for more information? $ Left_arr = array ();...