Sail E0 Webinar
Question
An array consist of n elements.We want to create a heap using the elements.The time complexity of building a heap will be in order of
Options:
A .  O(n*n*logn)
B .  O(n*logn)
C .  O(n*n)
D .  O(n *logn *logn)
Answer: Option B


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.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers