Answered step by step
Verified Expert Solution
Question
1 Approved Answer
5. (20 points) This problem considers your MinHeap implementation. Suppose it has been instantiated with sufficient space to hold n integers. Duplicates are allowed, as
5. (20 points) This problem considers your MinHeap implementation. Suppose it has been instantiated with sufficient space to hold n integers. Duplicates are allowed, as usual In terms of the code we used for lab, the name of the array representing the binary tree is array, and we have n = size array.length > size We will consider below some operations on the heap we have not previously seen. You may express your solution in code, in pseudocode, or in prose, but you must be clear and precise about what you are doing in your solutions. You will not be penalized for syntax problems. (a) (6 points) reduceToParent (int loc): the heap value at array index loc is decreased to the heap value of loc's parent. i. Complete the inquality below to indicate exactly those values for loc that are valid for this operation to work: i. Below describe your implementation for this method. Be sure that when your method is finished, the heap is in a valid state. iii. If the heap has n elements, your approach takes ( ) time
Step 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