Question
1.Suppose you need a new operation for the max priority queue (stored as an array). We will call it changeKey. The idea is this. You
1.Suppose you need a new operation for the max priority queue (stored as an array). We will call it changeKey. The idea is this. You have a priority queue (implemented as an array) to give out scholarships based on ACT. Someone retakes the ACT test and their score improves. You want to adjust the tree to accommodate this change. Assuming LOC is the position of the record in the array which has an improved key. How would you update the max priority queue?
Change the value at LOC. The element may need to bubble up in the heap
None of the others
A[LOC] = new value
2. A node in a binary heap has index 135 (located in cell 135 of the array representation of the heap). The array starts at location 0. List the indices of all of its ancestors.
67,33,16,7,3,1,0
67,33,16,8,4,2,1,0
67,33,16,8,4,2,1
3.Recall, the null path length of a node is how many nodes are in the shortest path to null.
For the leftist heap below, what is the null path length of node 8 in the heap?
This tree is not leftist.
2
0
3
1
4.In the heap below, which nodes have to swap their children in order to conform to the leftist heap property? Select all correct answers. This question might have multiple answers please keep that in mind.
10
39
2
8
19
9
10 19 31 30 40 56 23 25 45 40 52 56 10 30 19 31 39 56 23 25 45 40 52 56 10 19 31 30 40 56 23 25 45 40 52 56 10 30 19 31 39 56 23 25 45 40 52 56Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started