Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribedAttributes:

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

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

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

Challenges Facing Todays Organizations?

Answered: 1 week ago