Guest User

Untitled

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