retagged by
1,504 views
0 0 votes
Space complexity = input size + extra space

So, heap sort also takes input of an 'n' size array.

Does this mean that space cost of heap sort algo is O (n).

1 Answer

0 0 votes
Space complexity in heap sort will be height of the stack and for n number of nodes in complete or almost complete binary tree height would be logn so space complexity should be O(logn)
Position:
Show:

Related questions

0 0 votes
2 2 answers
5.4k
5.4k views
Hardik Maheshwari asked Jun 14, 2018
5,426 views
Since Heapify is a recursive function, its space complexity is $O(logn)$ because of the stack space required for recursion.I also read that space complexity of heapsort i...
1 1 vote
3 3 answers
2.1k
2.1k views
9 9 votes
2 answers 2 answers
6.9k
6.9k views
vineet.ildm asked Nov 7, 2016
6,870 views
Why space complexity of heapsort is O(1)....and why not O(logn)..because of space required by recursion calls which is equivalent to height of the tree...where am i getti...
1 1 vote
3 3 answers
3.5k
3.5k views
Akash Kumar Roy asked Apr 21, 2018
3,486 views
First read it properly. I am not asking a specific question about space complexity.Question: What is worst case space complexity of quick sort?Everywhere it is showing O(...