Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given the following sequence of numbers: 2 2 4 , 5 7 , 4 5 , 1 3 , 1 8 , 7 , 4
Given the following sequence of numbers:
Build a minheap
a What is the heapproperty that must be held?
b Construct the complete tree. For every adding into the heap, show the intermediate steps of the percolateup and
percolatedown in the complete tree and in the array
add
iv add
v add
vii. add
ii add
viii. add
iii. add
ix add
vi add
Draw the final result of built min heap
Based on the result of buildmin heap from previous question, perform heapsort. Hint: Buildmin removemin will lead
to the heap sort
a Show the intermediate steps of the percolation updown for every removeMin
b Show the state of the array that keeps the results of the removeMin every step
Fill out the following array with the resulting array from previous question. Suppose the target
a what is heap s parent? What is the formula to calculate its parent?
b what is heap s left child? What is the formula to calculate its left child?
c what is heaps right child? what is the formula to calculate its right child?
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