Question: For this assignment, you create your own version of a double-ended queue, known as a deque. Base your implementation using a doubly-linked list, a circular

For this assignment, you create your own version of a double-ended queue, known as a "deque". Base your implementation using a doubly-linked list, a circular linked list, or a combination of the two, a doubly-circular linked list. Up to you.

Submit your solution in a single header file named MyIntDeque.h. Do not submit screenshots. Do not submit a driver program. Submit only the header file.

Use the following UML diagram and attribute description for your implementation.

Attributes:

Node: A private, nested struct

value - holds the integer being stored in the deque.

next - holds the memory address of the next node in the deque.

prev - holds the memory address of the previous node in the deque.

front -a pointer that keeps track of the first node in the deque.

back - a pointer that keeps track of the last node in the deque.

Constructor - initializes the the front and back pointers to null.

Destructor - frees all memory used by the deque.

push_back - accepts an integer as it's only argument. Adds the integer to the end of the deque.

push_front - accepts an integer as it's only argument. Inserts the integer at the front of the deque.

pop_back - removes the integer at the end of the deque.

pop_front - removes the integer at the front of the deque.

size - returns the current number of values in the deque.

front - returns the value at the beginning of the deque if it's not empty, -1 otherwise.

back - returns the value at the end of the deque if it's not empty, -1 otherwise.

isFull - returns true if the deque is full, false otherwise.

isEmpty - returns true if the deque is empty, false otherwise.

clear - frees all memory used by the deque, thus emptying the deque. Leaves first and last set to null

Hints:

You can read about deques in the C++ library here.

Deques are sequential, that is, they are ordered like a queue.

Deques are queues where people could be added and removed from the front, or back.

Find here attached the driver.cpp for this

#include "MyIntDeque.h" #include using std::cout; using std::cin; using std::endl; int getNumber(); int main() { MyIntDeque m; char choice; int num; do { cout  "; cin >> choice; cin.ignore(1000, 10); cout > num; cin.ignore(1000, 10); return num; } 

i need help cause the last answer was wrong

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!