Question

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
                   n.next = head;
                   head.prev = n;
                   head = n;
                }else{                  
                   Node cur = head;
                   Node prev = null;
                   while (cur != null) {
                        if (cur.index == index) {
                            // set a[index] = data
                            cur.data = data;
                            break;
                        }else if (cur.index > index) {
                            // pass the right index
                            // create a new node infront of the current node
                            n.prev = cur.prev;
                            cur.prev.next = n;
                            n.next = cur;
                            cur.prev = n;
                            break;
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

Assisting Tutor

Related Homework Solutions

Java Problems: Integers, Strings, File Management & Arrays
Homework Solution
$33.00
Java
Programming
Coding
Computer Science
Input
Output
File Management
Arrays
Integers
Average Values
Methods
Functions
Parameters
Declaration
Strings
Prime Numbers
Generic Method For Java Arrays
Homework Solution
$20.00
Java
Programming
Coding
Computer Science
Arrays
Items
Generic Method
Integers
WordList
Strings
Testing
Primitive Types
Input
Output
ArrayList Fraction Objects in Java
Homework Solution
$15.00
Java
Programming
Computer Science
Coding
Arrays
Fractions
Numerator
Denominator
Decimal Values
Sorted List
Algorithms
Loops
Variables
Statements
Conditions
Get help from a qualified tutor
Live Chats