Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Algorithm B (Bubble Sort). Records R(1),...,R(N) are rearranged
- in place; after sorting is complete their keys will be in
- order, K(1)<=K(2)<= ...<=K(N).
- 1. Set BOUND <-- N (BOUND is the highest index for which
- the record is known to be in its final position).
- 2. Set t <-- 0, Perform step 3 for j=1,2,...,BOUND - 1, and then go to step 4
- 3. If K(j) > K(j+1) , interchange R(j) <--> R(j+1) and set t <-- j.
- 4. If t = 0 , the algorithm terminates, otherwise set BOUND <-- t
- and return to step 2.
Add Comment
Please, Sign In to add comment