Skip to content

Commit d70c319

Browse files
committed
added test for iterative mergesort
1 parent 63b706e commit d70c319

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pygorithm/sorting/merge_sort.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def sorti(_list):
6060
# breakdown every element into its own list
6161
series = [[i] for i in _list]
6262
while len(series) > 1:
63+
print(series)
6364
# iterator to handle two at a time in the zip_longest below
6465
isl = iter(series)
6566
series = [

tests/test_sorting.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ class TestMergeSort(unittest.TestCase, TestSortingAlgorithm):
116116
def sort(arr):
117117
return merge_sort.sort(arr)
118118

119+
class TestMergeSortIterative(unittest.TestCase, TestSortingAlgorithm):
120+
inplace = False
121+
alph_support = True
122+
123+
@staticmethod
124+
def sort(arr):
125+
return merge_sort.sorti(arr)
119126

120127
class TestQuickSort(unittest.TestCase, TestSortingAlgorithm):
121128
inplace = False

0 commit comments

Comments
 (0)