Last active
August 29, 2015 14:15
-
-
Save arekbulski/08e327455c97f34db46f 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
def divide(inputlist): | |
"""Dzieli liste na wejsciu na liste list pojedynczych elementow. | |
>>> divide([1,2,3]) | |
[[1],[2],[3]] | |
""" | |
pass | |
def merge(onelist, seclist): | |
"""Scala dwie posortowane listy w jedna posortowana liste. | |
>>> merge([1,2,4],[2,3,5]) | |
[1,2,2,3,4,5] | |
""" | |
pass | |
def sorting(inputlist): | |
"""Zwraca kolejne stany algorytmu sortowania. Nalezy uzyc dwoch funkcji powyzej. | |
Po kazdym scaleniu zwroc liste list (uzyj yield). | |
>>> sorting([0,5,3,1,2]) | |
**yield dla kazdej linii** | |
[[0], [5], [3], [1], [2]] | |
[[3], [1], [2], [0, 5]] | |
[[2], [0, 5], [1, 3]] | |
[[1, 3], [0, 2, 5]] | |
[[0, 1, 2, 3, 5]] | |
""" | |
pass | |
#--- NIE MODYFIKOWAC KODU PONIZEJ ---# | |
import pickle, sys | |
cases = pickle.load(sys.stdin) | |
for data in cases['divide'].values(): | |
print 'next divide' | |
print divide(data) | |
for (data1,data2) in cases['merge'].values(): | |
print 'next merge' | |
print merge(data1, data2) | |
for data in cases['sorting'].values(): | |
print 'next sorting' | |
for line in sorting(data): | |
print line | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment