Back to course home
0% completed
Vote For New Content
How is the space complexity O(N) for the sort?
Kennedy
Jun 3, 2023
Isn't sorting done in place? If so, shouldn't the space complexity because be constant if we are ignore the output array?
0
0
Comments
Comments
Shubham Voraa year ago
In Java, Arrays.sort is optimized and uses different algorithms based on the type of array:
- For Primitive Types (e.g.,
int[]): Java’sArrays.sortfor primitive types generally uses a variant of Dual-Pivot QuickSort. Its average-case space complexity i...
On this page