Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e0b5ae3

Browse files
committed
get_code has option to get iterative code
1 parent 395c2cd commit e0b5ae3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pygorithm/sorting/merge_sort.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,14 @@ def time_complexities():
7979
return "Best Case: O(nlogn), Average Case: O(nlogn), Worst Case: O(nlogn)"
8080

8181

82-
def get_code():
82+
def get_code(iter=False):
8383
"""
8484
easily retrieve the source code
8585
of the sort function
8686
8787
:return: source code
8888
"""
89+
if iter:
90+
return inspect.getsource(sorti) + "\n"
91+
8992
return inspect.getsource(sort) + "\n" + inspect.getsource(merge)

0 commit comments

Comments
 (0)