CSci 161 Lab #10
 
Code a static subroutine named heapVerifier that determines whether or not an array of integers is a heap. It should receive an array of integers as a parameter and it should return a boolean value. Its signature should be
public static boolean heapVerifier(int [] array);

You must also code a main routine which thoroughly tests your HeapVerifier method to confirm that it works correctly. Your main routine should read a textfile with zero or more integers on each line of the file. Each line is intended to represent one array of integers. There are as many arrays (and as many test cases) as there are lines in this file. It should be possible to give the main routine a filename (where the test cases are found) as a command line parameter, but you should provide a default filename if no command line parameter is provided. This way, we can run your program with our own test cases and (by omitting the command line parameter) we can run your program against your own test cases.

You might start by using

8 7 6 5 4 
32 14 29 11 6 23 7 2 4
34 31 30 28 13 12 17 16 8
as the contents of your input file and saving it with the filename heaps.txt. Add additional lines to this file to create new test cases for your heapVerifier method.

 
When you are finished, ask your lab instructor to check your work and record your scores.