Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bubblesort (A)
- for i = 1 to A.length - 1
- for j = A.length downto i + 1
- if A[j] < A[j - 1]
- exchange A[j] with A[j - 1]
- <?php
- function bubble_sort($A) {
- $c = count($A)-1;
- for ($i=0; $i<$c; $i++) {
- for ($j=0; $j<$c-$i; $j++) {
- $k = $j+1;
- if $A[$j] < $A[$j - 1] {
- }
- }
- echo json_encode($A);
- }
Add Comment
Please, Sign In to add comment