Java:
Create a method public static boolean isHeap( int[] cand ).
The isHeap method returns true if the cand field and its contents represent a (max) heap (see lecture slides from 1152). If the length of the cand field is less than 2, or if the cand field does not represent a heap, false is returned.
The cand field must not be modified when the isHeap method is executed.
public static boolean isHeap int[] cand ) { if (cand. Length > 1 ) { DAP 1 - Klausur } else { return false;
Java: Create a method public static boolean isHeap( int[] cand ). The isHeap method returns true if the cand field and i
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am