From 6c58be4cf9fe57ea126d3d78f23edcae6a38aac6 Mon Sep 17 00:00:00 2001 From: NoodlesIAte <90202919+IAteNoodles@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:01:52 +0530 Subject: [PATCH] Added space complexity Space complexity of merge sort is a key factor, when compared to quick sort --- sorts/merge_sort.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sorts/merge_sort.py b/sorts/merge_sort.py index 0628b848b794..2da660049526 100644 --- a/sorts/merge_sort.py +++ b/sorts/merge_sort.py @@ -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])