Skip to main content
Copy-edit
Source Link
David Richerby
  • 82.2k
  • 26
  • 144
  • 238

I understand that the worst space complexity of Bubble Sort is constant O(1), since all the space we need is the array where the elements were stored. But why doesis Merge SortSort's worst space complexity is O(n), linear? All space we need is the exact number of the elements, right? Please enlighten me.

I understand that the worst space complexity of Bubble Sort is constant O(1), since all the space we need is the array where the elements were stored. But why does Merge Sort worst space complexity is O(n) linear? All space we need is the exact number of the elements right? Please enlighten me.

I understand that the worst space complexity of Bubble Sort is constant O(1), since all the space we need is the array where the elements were stored. But why is Merge Sort's worst space complexity O(n), linear? All space we need is the exact number of the elements, right? Please enlighten me.

Source Link

Worst Case Space Complexity of Merge Sort and Bubble Sort

I understand that the worst space complexity of Bubble Sort is constant O(1), since all the space we need is the array where the elements were stored. But why does Merge Sort worst space complexity is O(n) linear? All space we need is the exact number of the elements right? Please enlighten me.