Guest User

Untitled

a guest
Dec 16th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. bubblesort (A)
  2. for i = 1 to A.length - 1
  3. for j = A.length downto i + 1
  4. if A[j] < A[j - 1]
  5. exchange A[j] with A[j - 1]
  6.  
  7. <?php
  8. function bubble_sort($A) {
  9. $c = count($A)-1;
  10. for ($i=0; $i<$c; $i++) {
  11. for ($j=0; $j<$c-$i; $j++) {
  12. $k = $j+1;
  13. if $A[$j] < $A[$j - 1] {
  14.  
  15. }
  16. }
  17. echo json_encode($A);
  18. }
Add Comment
Please, Sign In to add comment