An array consists of n elements. We want to create a heap using the elements. The time complexity of building a heap will be in order of
An array consists of n elements. We want to create a heap using the elements. The time complexity of building a heap will be in order of Correct Answer O(n*logn)
The total time taken will be N times the complexity of adding a single element to the heap. And adding a single element takes logN time, so That is equal to N*logN.