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.

For this assignment, you create your own version of a double-ended queue,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

MylntDeque Node value: int next Node* Node* -first: Node* -last Node* +MylntDeque: -MylntDeque0 +push_back(i: int):void +push_front(i :int):void +pop back(): void +pop front(): void +size(): int +front(): int +back(): int +isFull): bool +isEmpty(): bool +clear): void

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!