Question

explain briefly(d) (4%) What kind of heaps is required in heap sort with non-decreasing order? Why? (e) (4%) Consider the single source all

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

Answer d - For the heaps of non-decreasing order the max-heap is required, because of the following reason:-

=> The key represented by the root node which must be the greatest of all the keys among the children

Answer e- Considering the single source all destination problem the algorithm only says to not have a negative cycle. For the negative length, the algorithm is not correct because the non-negativity is the proof for the single-source all destination problem. The algorithm will surely stop after iterations n-1 for n vertices.

For the negative cycle implementable form, as there will be no shortest path from source to the vertex on the given cycle, hence solution can be obtained for this going around cycle on every path although this will take additional time.

Answer f- Suppose the node is n on the given path say p upto the root and

parent[p] != root(p), so this the collapsing rule for the trees formed by the adjoint sets then the parent[n] set to the root(p)

For the application of the find() operation

The compression should be done for that to find out the root because if we make the found root the parent of the element so there will be no need to traverse again from the element to find out the root.

//I TRIED TO EXPLAIN AS BRIEFLY AS POSSIBLE AS YOU MENTIONED ABOVE IF STILL SOME QUERIES PLEASE REVERT IN THE COMMENT SECTION FOR FURTHER HELP...............HAPPY TO HELP!!!!!!!!!!!

Add a comment
Know the answer?
Add Answer to:
explain briefly (d) (4%) What kind of heaps is required in heap sort with non-decreasing order?...
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