-
-
Notifications
You must be signed in to change notification settings - Fork 47.1k
Closed
Description
Hi @harshildarji & @yesIamHasi ,
Thanks for sharing algorithm source code and I really like them.
Just want to raise an issue on '/sorts/merge_sort_fastest.py' that it is not an merge_sort option as there are dependencies on python built-in functions - remove(), max() & min(), which makes 'merge_sort_fastest' like O(n^2) [ (n*(n+1)) / 2 * 2 as one max()/min() with remove()] instead of O(n log n).
For example, while sorting 50,000 random numbers with below list:
unsorted = random.sample(range(0, 100000), 50000)
The running result will be like:
(venv) $ time python3 merge_sort.py
real 0m0.361s
user 0m0.347s
sys 0m0.011s
(venv) $ time python3 merge_sort_fastest.py
real 0m49.306s
user 0m49.103s
sys 0m0.099s
thanks!
Tom
serapred, somenzz, azhusubaliev, Lobshunter86 and jai-dewani
Metadata
Metadata
Assignees
Labels
No labels