Heap Sort: Following is the Array Repte sentation of Max Heap H, You can see tha
ID: 3614746 • Letter: H
Question
Heap Sort: Following is the Array Repte sentation of Max Heap H, You can see that every node except leaf nodes in parent of some other nodes, we also know from the course of data strictures that in a binary tree, Parent of node i = node L[i/2] For example, parent of rode 6 will be node [6/2] is node 3 parent of rode 7 will be node [7/2] is node 3 (lows r bound 3.5 will be changed to 3) Using this formula you have to give the general relation of are node i with its parent node [i/2], justify your answer as well. You have to write anyone of the following symbols [>, = ,Explanation / Answer
Question 1: The "general relation of any node and its parent" is better knownas the Heap Property. This property states that the value of a node is *never* greaterthan the value of the parent of the node Question 2, part b: It's essential to realise that each recursive step of Quicksortbreaks up its input array in two subarrays, and needs to perform awhole bunch of comparisons to do this. Intuitively, it's not too hard to realise breaking the array upinto two arrays of approximately the same size minimizes the amountof comparisons. Now, if you know the array is sorted in a non-decreasing fashion,you can be smart about choosing the pivot element. Which element of the array should be chosen in this case? One inthe middle of the array would be an excellent one
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.