Advertisement
cwchen

Insertion Sort pseudocode

Aug 22nd, 2017
766
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. Let A a zero-based array with size n
  2.  
  3. for i from 1 to n - 1 {
  4. x = A[i]
  5. j = i
  6. while j > 0 and A[j-1] > x {
  7. A[j] = A[j-1]
  8. j = j - 1
  9. }
  10. A[j] = x
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement