Skip to content

Commit 395c2cd

Browse files
committed
added verbose option
1 parent d70c319 commit 395c2cd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pygorithm/sorting/merge_sort.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def sort(_list):
4949
return merge(a, b)
5050

5151
from itertools import zip_longest
52-
def sorti(_list):
52+
def sorti(_list, verbose=True):
5353
"""
5454
Function to sort an array
5555
using merge sort algorithm, iteratively
@@ -60,7 +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)
63+
if verbose: print(series)
6464
# iterator to handle two at a time in the zip_longest below
6565
isl = iter(series)
6666
series = [

tests/test_sorting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class TestMergeSortIterative(unittest.TestCase, TestSortingAlgorithm):
122122

123123
@staticmethod
124124
def sort(arr):
125-
return merge_sort.sorti(arr)
125+
return merge_sort.sorti(arr, verbose=False)
126126

127127
class TestQuickSort(unittest.TestCase, TestSortingAlgorithm):
128128
inplace = False

0 commit comments

Comments
 (0)