Question 14308 – Database-Management-System
December 19, 2023Question 14283 – Digital-Logic-Design
December 20, 2023Question 9186 – Data-Structures
We have a binary heap on n elements and wish to insert n more elements (not necessarily one after another) into this heap. The total time required for this is
Correct Answer: B
Question 60 Explanation:
Inserting an element into binary(either max or min) heap takes O(logn) for all cases, but in question they clearly mentioned that n elements and inserting one by one n elements, so it takes 2n time. So, O(n).
Note: We can also insert all the elements once, there will be no difference on time complexity.
Note: We can also insert all the elements once, there will be no difference on time complexity.
θ(log n)
θ(n)
θ(nlog n)
θ(n2)
Subscribe
Login
0 Comments