Question

3. N elements are inserted from a min-heap with N elements. The total running time is:...

3. N elements are inserted from a min-heap with N elements. The total running time is:

a) O(N2) worst case

b) O(logN) worst case

c) O(N) worst case          

d) None of these

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer 3.)

(c) O(N) - Worst case

When N elements are inserted in a min-heap with N elements, the time complexity for this is O(LogN) - in worst case (in general). So, it will take Θ(NlogN) time.

But O(N) is the most appropriate answer.

The solution of time complexity O(N) takes the min-heap with N elements and other 'N' elements are to be inserted. It will construct min-heap in O(2N).

O(2N) can be written in the form O(N).

So, the total running time when N elements are inserted in a min-heap with N elements is O(N).

Add a comment
Know the answer?
Add Answer to:
3. N elements are inserted from a min-heap with N elements. The total running time is:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT