Question: Question 20 (5 points) Complete the function isMinHeap which takes an array of doubles and returns true if the array is a min heap (with
Question 20 (5 points) Complete the function isMinHeap which takes an array of doubles and returns true if the array is a min heap (with the smallest element first). Consider only the elements a[1] ... a[N] - you should ignore a[@1. but you should include a[N]. You can assume that N s (a.length - 1). Your code must run in linear time. public static boolean isMinHeap(double[] a, int N) { if (N >= a.length) throw new IllegalArgumentException()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
