Question

2. If you are using HeapSort to put elements in ascending order, what kind of heap should you use? Why? Conduct your HeapSort uisng the sequence given in task 1 (show the array after each round of sorting) (6 points)

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

Max heap can be used for sorting elements in ascending order. A max heap is a complete binary tree such that each internal node has value greater than or equal to their child nodes.

Heap sort for ascending order works by deleting the root node each time and restoring the heap based on the property we just explained. Once the heap is restored, the process of deleting repeats iteratively and the elements are stored in reverse order to display the sort in ascending order else the elements can be linearly stored to sort the elements in descending order.

Add a comment
Know the answer?
Add Answer to:
2. If you are using HeapSort to put elements in ascending order, what kind of heap...
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