retagged by
679 views
0 votes
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).
retagged by

1 Answer

0 votes
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)

Related questions

1 votes
1 votes
3 answers
2
9 votes
9 votes
2 answers
3
vineet.ildm asked Nov 7, 2016
5,807 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...