'\0' 'b' 'd' 'm' 'f' 'r' 'v' 'p' 'q' 'h' 'w' 'j' 'z'
Insert('k')
is called.DeleteMin()
is called.DecreaseKey()
is
called on the node with value 'p' to lower it to 'a'.IncreaseKey()
is
called on the node with value 'f' to raise it to 'm'.Delete()
is called
on the node with value 'h'.
BuildHeap()
for an integer heap as
we discussed in class so that it runs in linear time:void BuildHeap(integer input[],int numelems);The number of elements given to you in the array is indicated by
numelems
, and these values will be stored at positions
0..numelems
. Your heap should store the root at position
1 as we've discussed in lecture and should store a sentinel that is
appropriate for the input values at position 0. You should return the
heap using the same array and you may assume that the user has
allocated plenty of extra memory for you to store the extra value at
the end of the array (as well as any end-of-array sentinel values if
you wish).
"I am looking for someone to date. The most important criteria to me is that the person is intelligent. They should have scored at least 1100 on their SATs, and the better they did, the more attractive I would find them. The next most important characteristic is height. I'm 5' 11" and would ideally like someone my same height. For every inch shorter or taller than me that they are, I'd be a bit less interested."Fortunately for you, you happen to have SAT scores and heights for all the people in your database. Even more fortunately for you, you took CSE 373, so you know about heaps. In a few sentences explain how you could use a heap to find the top matches for this client.