Question: I'm studying for a data structures exam And have a study guide with solutions but am confused about how they got the answer for 2C
2. (25 points) (a) What are the minimum and maximum numbers of elements in a heap of height h? Solution: Minimum of nodes happens in a heap in which the last level contains only one node Thus, minimum of nodes-+2 +22 +.21-2 Maximum of nodes happens in a heap in which the last level is full. of nodes =2+21 +22 + .. . 2h=2A+ 1-1. Thus, maximum (b) Is an array that is in sorted order a min-heap?. Justify Solution: . A sorted array A has the property that A Aj] for any two indexes i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
