Part-1(Java)Create a doubly linked list based DeQueDLL class that implements the DequeInterface. The class skeleton and interface are provided to you.Implement a String toString () method that creates and returns a string that correctly represents the current deque. Such a method could prove useful for testing and debugging the class and for testing and debugging applications that use the class. Assume each queued element already provides its own reasonable toString method.Skeleton:import ch04.queues.*;import support.DLLNode;public class DeQueDLL<T> implements DequeInterface<T> {protected DLLNode<T> front, rear; // reference to the front and rear of this dequeprotected int numElements = 0; // number of elements in this dequepublic DeQueDLL() {front = null;rear = null;}public void enqueueFront(T element) {// TODO Auto-generated method stub}public void enqueueRear(T element) {// TODO Auto-generated method stub}public T dequeueFront() throws QueueUnderflowException {// TODO Auto-generated method stubreturn null;}public T dequeueRear() throws QueueUnderflowException {// TODO Auto-generated method stubreturn null;}public boolean isFull() {// TODO Auto-generated method stubreturn false;}public boolean isEmpty() {// TODO Auto-generated method stubreturn false;}public int size() {// TODO Auto-generated method stubreturn 0;}} import ch04.queues.QueueOverflowException;import ch04.queues.QueueUnderflowException;public interface DequeInterface<T>{void enqueueFront(T element) throws QueueOverflowException;// Throws QueueOverflowException if this queue is full;// otherwise, adds element to the front of this queue.void enqueueRear(T element) throws QueueOverflowException;// Throws QueueOverflowException if this queue is full;// otherwise, adds element to the rear of this queue.T dequeueFront() throws QueueUnderflowException;// Throws QueueUnderflowException if this queue is empty;// otherwise, removes front element from this queue and returns it.T dequeueRear() throws QueueUnderflowException;// Throws QueueUnderflowException if this queue is empty;// otherwise, removes rear element from this queue and returns it.boolean isFull();// Returns true if this queue is full; otherwise, returns false.boolean isEmpty();// Returns true if this queue is empty; otherwise, returns false.int size();// Returns the number of elements in this queue.}

Question
Asked Oct 15, 2019
221 views

Part-1(Java)

  1. Create a doubly linked list based DeQueDLL class that implements the DequeInterface. The class skeleton and interface are provided to you.
  2. Implement a String toString () method that creates and returns a string that correctly represents the current deque. Such a method could prove useful for testing and debugging the class and for testing and debugging applications that use the class. Assume each queued element already provides its own reasonable toString method.

Skeleton:

import ch04.queues.*;
import support.DLLNode;

public class DeQueDLL<T> implements DequeInterface<T> {

protected DLLNode<T> front, rear; // reference to the front and rear of this deque
protected int numElements = 0; // number of elements in this deque

public DeQueDLL() {
front = null;
rear = null;
}

public void enqueueFront(T element) {
// TODO Auto-generated method stub

}

public void enqueueRear(T element) {
// TODO Auto-generated method stub

}

public T dequeueFront() throws QueueUnderflowException {
// TODO Auto-generated method stub
return null;
}

public T dequeueRear() throws QueueUnderflowException {
// TODO Auto-generated method stub
return null;
}

public boolean isFull() {
// TODO Auto-generated method stub
return false;
}

public boolean isEmpty() {
// TODO Auto-generated method stub
return false;
}

public int size() {
// TODO Auto-generated method stub
return 0;
}

}

 

import ch04.queues.QueueOverflowException;
import ch04.queues.QueueUnderflowException;

public interface DequeInterface<T>
{
void enqueueFront(T element) throws QueueOverflowException;
// Throws QueueOverflowException if this queue is full;
// otherwise, adds element to the front of this queue.

void enqueueRear(T element) throws QueueOverflowException;
// Throws QueueOverflowException if this queue is full;
// otherwise, adds element to the rear of this queue.

T dequeueFront() throws QueueUnderflowException;
// Throws QueueUnderflowException if this queue is empty;
// otherwise, removes front element from this queue and returns it.

T dequeueRear() throws QueueUnderflowException;
// Throws QueueUnderflowException if this queue is empty;
// otherwise, removes rear element from this queue and returns it.

boolean isFull();
// Returns true if this queue is full; otherwise, returns false.

boolean isEmpty();
// Returns true if this queue is empty; otherwise, returns false.

int size();
// Returns the number of elements in this queue.

}

 

check_circle

Expert Answer

Step 1

Assuming the DLLNode class with given methods (use methods of your implementation of DLLNode class):

class DLLNode<T>{   

    private DLLNode<T> prev;

    private DLLNode<T> next;

    private T value;

 

    public DLLNode<T> getPrev() {

        return prev;

    }

    public void setPrev(DLLNode<T> prev) {

        this.prev = prev;

    }

    public DLLNode<T> getNext() {

        return next;

    }

    public void setNext(DLLNode<T> next) {

        this.next = next;

    }

    public T getValue() {

      &...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Java

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: How can you check if a public computer has a USB keylogger installed

A: Universal Serial Bus (USB) keyloggers:These keyloggers are typically in the form of Universal Serial...

question_answer

Q: Design a reasonably efficient algorithm for solving each of the following problems and determine its...

A: AlgorithmLet x be one of the numbers and the other number is n-x. The first step is to maximize f(x)...

question_answer

Q: Write the MIPS assembly code that corresponds to the pseudo codebelow. Assume that the address for i...

A: MIPS instruction:The full form of MIPS is Million Instructions Per Second.The speed of computer’s pr...

question_answer

Q: Draw the truth tables for the following Boolean expressions. xy+yz+xz x¯y+yz¯+x¯z (x⊕y)+(y⊕z)+(x...

A: Hello. Since you have posted multiple questions and not specified which question needs to be solved,...

question_answer

Q: Please explain how you solve the follwing problem:

A: Since you have posted multiple questions and have not specified which question needs to be solved, w...

question_answer

Q: Write a Java class, XXX_Lab71, where XXX is your Kean email ID. The classwill do the following:1) Cr...

A: Program://definition of classclass XXX_Lab71{  //definition of main method  public static void main(...

question_answer

Q: Python 3.7.4 Store four file objects corresponding to the files winter2003.txt , spring2003.txt, sum...

A: Python statements for creating file objects: winter=open("winter2003.txt", "r")spring=open("spring20...

question_answer

Q: What are whole disk encryption (WDE) solutions and under what circumstances are they required?

A: DefinitionWhole Disk Encryption (WDE) solutions, basically plays the foremost role in the field of c...

question_answer

Q: I'm not sure how to use pumping lemma on this or if I should be using a different method

A: If a language is regular, then it must satisfy pumping lemma.Pumping lemma: If L is any regular lang...