COL 106 Assignment 4
|
interface eArray <T> { T at(int index); void set(int index, T value); } class pTuple <T> { T e_; int priority_; pTuple(T e, int priority) { e_ = e; priority_=priority; } T element() { return e_; } int priority() { return priority_; } } interface priorityQ <T> { void construct(eArray<pTuple <T>> t); pTuple <T> dequeue(); void enqueue(T e, int priority); void enqueue(pTuple <T> t); }
There should be no use of arrays except inside a class that implements eArray. Arrays of String are allowed in main.
It then print a pre-order traversal of the heap on standard output, one nodes' tuple printed per line.
Name1 is a string 239 Name2 string 889 Third 2391 Word 231 None 2Example output
Third 2391 Name2 string 889 Name1 is a string 239 None 2 Word 231
Please ensure that you follow the following set of instructions meticulously while submitting the assignment on Moodle. Also, please note that in case of deviation from this procedure will render your submission faulty, and your assignment might not be evaluated at all by the script. Please follow these steps:
your-entry-number_assignment4.zipExample: If your entry number is 2012CSZ8019, the zip file should be named 2012CSZ8019_assignment4.zip. It should expand to a directory called src, which contains all your .java files. Please make sure that you follow exactly this naming format.
base64 entrynumber_assignment4.zip > entrynumber_assignment4.zip.b64This will create a file with the same name with a b64 extension appended at the end.
java version "1.7.0_79" OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu0.12.04.1) OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)