Link-List Based Implementation Of Heap
You MUST use Eclipse as IDE.
Your program MUST compile and run without error.
Write a link-list based implementation of heap interface.
It should have implementation for following four methods.
 enqueue()
 dequeue()
 isEmpty()
 isFull()

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

Node n = new Node(data, null, null, index);
                if (n.index < head.index) {
                   // a[2] = a [1], a[11 = a[0], a [0] = data
          = head;
                   head.prev = n;
                   head = n;
                   Node cur = head;
                   Node prev = null;
                   while (cur != null) {
                        if (cur.index == index) {
                            // set a[index] = data
                   = data;
                        }else if (cur.index > index) {
                            // pass the right index
                            // create a new node infront of the current node
                            n.prev = cur.prev;
                   = n;
                   = cur;
                            cur.prev = n;
void enqueue(T element);
// Precondition: element is Comparable
// Throws PriQOverflowException if this priority queue is full;
// otherwise, adds element to this priority queue....

This is only a preview of the solution. Please use the purchase button to see the entire solution


or free if you
register a new account!

Assisting Tutor

Related Homework Solutions

Get help from a qualified tutor
Live Chats