Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this project you will create a deque that does not allow duplicates. The function of the deques operations addToBack and addToFront leave the deque

In this project you will create a deque that does not allow duplicates. The function of the deques operations addToBack and addToFront leave the deque unchanged if the the objects are already in the deque, Add two operations, moveToBack and moveToFront. These operations will move an existing object the back (or front) of the deque, if the object is present in the deque. If the object is not already in the deque, it will add the object to the back (or front) of the deque. Create an interface NoDuplicatesDequeInterface that extends DequeInterface. Then write class - named CSE274Deque - that is a doubly linked implementation of NoDuplicatesDequeInterface. Finally, write a program that adequately demonstrates your new class. public interface.

public interface DequeInterface {

/**

* Adds a new entry to the front/back of this dequeue.

*

* @param newEntry An object to be added.

*/

public void addToFront(T newEntry);

public void addToBack(T newEntry);

/**

* Removes and returns the front/back entry of this dequeue.

*

* @return The object at the front/back of the dequeue.

* @throws EmptyQueueException if the dequeue is empty before the operation.

*/

public T removeFront();

public T removeBack();

/**

* Retrieves the front/back entry of this dequeue.

*

* @return The object at the front/back of the dequeue.

* @throws EmptyQueueException if the dequeue is empty before the operation.

*/

public T getFront();

public T getBack();

/*

* Detects whether this dequeue is empty.

*

* @return True if the queue is empty, or false otherwise.

*/

public boolean isEmpty();

/* Removes all entries from this dequeue. */

public void clear();

public int size();

} // end DequeInterface

public class CSE274Deque implements NoDuplicatesDequeInterface {

@Override

public void addToFront(Object newEntry) {

// TODO Auto-generated method stub

}

@Override

public void addToBack(Object newEntry) {

// TODO Auto-generated method stub

}

@Override

public Object removeFront() {

// TODO Auto-generated method stub

return null;

}

@Override

public Object removeBack() {

// TODO Auto-generated method stub

return null;

}

@Override

public Object getFront() {

// TODO Auto-generated method stub

return null;

}

@Override

public Object getBack() {

// TODO Auto-generated method stub

return null;

}

@Override

public boolean isEmpty() {

// TODO Auto-generated method stub

return false;

}

@Override

public void clear() {

// TODO Auto-generated method stub

}

@Override

public int size() {

// TODO Auto-generated method stub

return 0;

}

@Override

public void moveToBack() {

// TODO Auto-generated method stub

}

@Override

public void moveToFront() {

// TODO Auto-generated method stub

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions

Question

Multiplication and division. Simplify. (a 1)(a 2 2a + 1)

Answered: 1 week ago