What is the best case complexity in building a heap?

Category: QuestionsWhat is the best case complexity in building a heap?
Editor">Editor Staff asked 4 weeks ago

What is the best case complexity in building a heap?
 
(a) O(nlogn)
 
(b) O(n^2)
 
(c) O(n*longn *logn)
 
(d) O(n)
 
Origin of the question is Binary Heap in portion Heap of Data Structures & Algorithms I
 
The question was asked by my school teacher while I was bunking the class.

1 Answers
Editor">Editor Staff answered 4 weeks ago

The correct option is (d) O(n)
 
For explanation: The best case complexity occurs in bottom-up construction when we have a sortes array given.