Skip to content

Commit 6c58be4

Browse files
authored
Added space complexity
Space complexity of merge sort is a key factor, when compared to quick sort
1 parent 40f65e8 commit 6c58be4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

sorts/merge_sort.py

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def merge_sort(collection: list) -> list:
1818
:return: The same collection ordered in ascending order.
1919
2020
Time Complexity: O(n log n)
21+
Space Complexity: O(n) due to the temporary arrays created during the merging process.
2122
2223
Examples:
2324
>>> merge_sort([0, 5, 3, 2, 2])

0 commit comments

Comments
 (0)