The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

0 votes

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 is $O(1)$ beause of the explanation here - https://gateoverflow.in/79909/space-complexity-of-heap-sort .

So my question is why the space complexity of **Build Heap** is $O(logn)$ ?

If space complexity of build heap is $O(logn)$ then heapsorts complexity should also be the same . What am I missing here ?

- All categories
- General Aptitude 1.6k
- Engineering Mathematics 7.3k
- Digital Logic 2.7k
- Programming & DS 4.9k
- Algorithms 4.2k
- Theory of Computation 5.4k
- Compiler Design 2.1k
- Databases 4k
- CO & Architecture 3.5k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.5k
- Admissions 570
- Exam Queries 566
- Tier 1 Placement Questions 23
- Job Queries 70
- Projects 18

48,756 questions

52,850 answers

183,548 comments

68,743 users