Added space complexity

Space complexity of merge sort is a key factor, when compared to quick sort
This commit is contained in:
NoodlesIAte 2024-10-04 10:01:52 +05:30 committed by GitHub
parent 40f65e8150
commit 6c58be4cf9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,6 +18,7 @@ def merge_sort(collection: list) -> list:
:return: The same collection ordered in ascending order.
Time Complexity: O(n log n)
Space Complexity: O(n) due to the temporary arrays created during the merging process.
Examples:
>>> merge_sort([0, 5, 3, 2, 2])