Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(15 points) In class, we have studied max-heap and its operations in details. The min-heap data structure is defined similarly, with max replaced by min,
(15 points) In class, we have studied max-heap and its operations in details. The min-heap data structure is defined similarly, with max replaced by min, greater than replaced by less than, etc. The operations of min-heap is also symmetric to the corresponding operations of the max-heap. This question is about the min-heap. A min-heap with capacity 20 and size 10 is shown in the following array format. The following three sub-questions all refer to this min-heap (not, the heap you obtained after doing some operations). (a) On the answer sheet, show the result after applying heap-extract-min(A) to the minheap at the start of this question. (b) On the answer sheet, show the result after applying heap-decrease-key (A, 10, 0) to the min-heap at the start of this question. 1 (c) On the answer sheet, show the result after applying min-heap-insert (A, - 1 ) to the min-heap at the start of this question. Q2: Read the instructions for question Q2 in the assignment document. For each of the three sub-questions, write your answer to the question in the given space. (a): After the extract-min operation, we have A[1]= A[2]= A[3]= A[4]= A[8]= (b): After the decrease-key operation, we have A[1]= A[2]= A[3]= A[4]= A[9]= (c): After the insertion operation, we have A[1]= A[2]= A[3]= A[5]= A[11]=
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