Home » Programming & Data Structure » Programming and data structure miscellaneous » Question

Programming and data structure miscellaneous

Programming & Data Structure

  1. 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
    1. Θ (log n)
    2. Θ (n)
    3. Θ (n log n)
    4. Θ (n2)
Correct Option: B

Heaps are implemented as simple arrays, to insert n more elements each element take Θ(1) time. So total time would be Θ(n).



Your comments will be displayed only after manual approval.