Guest User

Untitled

a guest
Feb 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. def insertion_sort(words)
  2. words.each_with_index do |word, index|
  3.  
  4. index.downto(0) do |placement|
  5. if (placement > 0 && word < words[placement-1])
  6. words[placement] = words[placement-1]
  7. else
  8. words[placement] = word
  9. break
  10. end
  11. end
  12.  
  13. end
  14. end
Add Comment
Please, Sign In to add comment