Last active
November 30, 2015 23:55
-
-
Save bpicolo/32a7fc775ce1810c88a0 to your computer and use it in GitHub Desktop.
andrescusort
This file contains hidden or 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
Dirty code: | |
import heapq | |
stuff = ["A Hard Day's Night", 'All About Eve', 'Boyhood', 'Citizen Kane', 'Das Cabinet des Dr. Caligari. (The Cabinet of Dr. Caligari)', 'E.T. The Extra-Terrestrial', 'Inside Out', 'It Happened One Night', 'King Kong', 'Laura', 'Metropolis', 'Modern Times', 'North by Northwest', 'Repulsion', "Singin' in the Rain", 'Snow White and the Seven Dwarfs', 'The Adventures of Robin Hood', 'The Godfather', 'The Third Man', 'The Wizard of Oz'] | |
start = 1 | |
end = [] | |
while(stuff): | |
end.append([]) | |
for i in range(start * start): | |
if not stuff: | |
break | |
end[-1].append(stuff.pop(0)) | |
heapq._heapify_max(end[-1]) | |
start = start + 1 | |
# end dirty code | |
[ | |
["A Hard Day's Night"], | |
['Das Cabinet des Dr. Caligari. (The Cabinet of Dr. Caligari)', 'Boyhood', 'Citizen Kane', 'All About Eve'], | |
['Repulsion', 'North by Northwest', 'Modern Times', 'King Kong', 'Laura', 'Metropolis', 'It Happened One Night', 'Inside Out', 'E.T. The Extra-Terrestrial'], | |
['The Wizard of Oz', 'The Third Man', 'The Adventures of Robin Hood', 'The Godfather', 'Snow White and the Seven Dwarfs', "Singin' in the Rain"] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment