Question
Discrete Mathematics

Repeat Maximizing the Heap The process of maximizing the heap and removing vertices continues until the heap has one vertex.
0 0
Add a comment Improve this question Transcribed image text
Answer #1
Algorithm Best Case Worst Case
Selection O(n2) O(n2)
Bubble O(n) O(n2)
Heap O(n log n) O(n log n)

Selection Sort:

Time Complexity: O(n2) in both best and worst as there are two nested loops, so number of comparisons performed are equal in both best and worst case.

Bubble Sort:

Worst and Average Case Time Complexity: O(n*n). Worst case occurs when array is reverse sorted.

Best Case Time Complexity: O(n). Best case occurs when array is already sorted.

Heap Sort:

Time Complexity: Time complexity of "Repeat Maximizing the Heap" operation given above is O(log n). Time complexity of creating and building heap is O(n) and thus overall time complexity of Heap Sort is O(n log n) in both best and worst case.

Please Upvote

Thank you

Add a comment
Know the answer?
Add Answer to:
Discrete Mathematics Repeat Maximizing the Heap The process of maximizing the heap and removing vertices continues until the heap has one vertex. The following results of the remaining steps for...
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