Program to check if heap order is correct or not
up vote
0
down vote
favorite
There is a Java program to check if a Heap (Min) is in the correct order. Heap Order means the parent is less than both left child and right child. package testers; import heap.Heap; import java.util.List; public class HeapTester { public static void main(String args) { Heap<Integer> heap = new Heap <>(); heap.add(50); heap.add(25); heap.add(26); heap.add(15); heap.add(10); heap.add(16); heap.add(3); heap.add(7); heap.add(10); heap.add(12); heap.add(2); System.out.println(heap); System.out.println(hasHeapOrder(heap.copy())); } private static <T extends Comparable<T>> boolean hasHeapOrder(List<T> list) { if(li...