Skip to content

Instantly share code, notes, and snippets.

@robbie01
Created December 30, 2016 05:44
Show Gist options
  • Save robbie01/c545e7d46913188a4432d7ef6a977277 to your computer and use it in GitHub Desktop.
Save robbie01/c545e7d46913188a4432d7ef6a977277 to your computer and use it in GitHub Desktop.
Timsort implemented in Python 3
if __name__ == '__main__':
from sys import argv
from random import shuffle
list = list(range(int(argv[1])))
list.sort() # ;)
print(all(list[i] <= list[i+1] for i in range(len(list)-1)))
# seriously though timsort is really weird
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment