Created
April 16, 2012 04:53
-
-
Save dcolish/2396383 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def insert_sort(l): | |
for i, item in enumerate(l): | |
while i > 0 and l[i - 1] > item: | |
l[i] = l[i - 1] | |
i -= 1 | |
l[i] = item | |
things = range(10) | |
random.shuffle(things) | |
print things | |
insert_sort(things) | |
print things |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment