Argument at index 0: a number representing the number of elements to be
tossed onto a heap. If N elements are tossed onto a heap, each element
shall be in the range [0, N-1].
Standard input is read, and should contain bytes [read: binary data] of
input defining
integer elements to be tossed onto the heap, with enough
bytes to define N integers (each integer is 4 bytes of standard input).
Integers are
defined from the input by taking groups of 4 consecutive bytes from input,
each group defining a single integer by interpreting the first byte in
a group to be the most significant bits of the integer etc. The
range [0, N-1] of each integer is satisifed by dividing the positized
value of each assembled
four-byte integer by N, and taking the remainder as the element to be
tossed onto the heap.
Writes to standard out the ordered set of input integers with
duplicates pruned, such that each output integer is followed by the
system's newline separator character sequence. The integers written are
in plaintext, unlike the format of the input.
Output to standard error is the time taken to use the heap to order
the input, with duplicates removed. The output format is simply a
plaintext
integer representing the number of milliseconds required for this
test case, followed by the system's newline separator character
sequence. Basically, a timer starts
right before calling the MinIntHeap constructor with an array of
input integers; the timer stops after we've instantiated a new array to
contain the ordered list of elements with duplicates removed, and after
we've completely filled the array with these elements. Note that
the process of instantiating this array is time consuming and has nothing
to do with the algorithm we're trying to test; this operation is
included in this time trial anyways.
An optional second argument to this program is the string 'repeat' -
this command-line option will run a first test, and then a repeated test
using the same objects that were used in the first test (basically, the
purpose of the repeated test is to not instantiate anything) - all
output information is based off of the repeated test.
- Throws:
Exception