Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ArrayedMinHeap280<Integer> heap = new ArrayedMinHeap280<Integer>(5);
- heap.insert(3);
- heap.insert(9);
- heap.insert(1);
- heap.insert(15);
- heap.insert(-5);
- System.out.println("Expected output of heap is: -5, 1, 3, 15, 9.");
- System.out.println("Output of heap is: " + heap);
- System.out.println();
- heap.removeItem();
- System.out.println("Expected root of heap is 1.");
- System.out.println("Root of heap is: " + heap.item());
- System.out.println("Output of heap is: " + heap);
- System.out.println();
- heap.removeItem();
- System.out.println("Expected root of heap is 3.");
- System.out.println("Root of heap is: " + heap.item());
- System.out.println("Output of heap is: " + heap);
- System.out.println();
- heap.removeItem();
- System.out.println("Expected root of heap is 9.");
- System.out.println("Root of heap is: " + heap.item());
- System.out.println("Output of heap is: " + heap);
- System.out.println();
- heap.removeItem();
- System.out.println("Expected root of heap is 15.");
- System.out.println("Root of heap is: " + heap.item());
- System.out.println("Output of heap is: " + heap);
- heap.removeItem();
- if (!heap.isEmpty())
- {
- System.out.println("Heap should be empty, but it is not.");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement