Question
A FIFO queue allows one to store information so that the first item entered into the queue is also the first to exit from it
A FIFO queue allows one to store information so that the first item entered into the queue is also the first to exit from it (FIFO = first-in, first-out). This can be generalized to give a double-ended queue (or dequeue, or deque). A double-ended queue is a data type that allows you to add an item to the front or the back of the queue, and also to remove an item from either the front or the back.
Write C++ code that defines and implements a double-ended queue data type to store floating point numbers. In addition to creating and destroying a deque, make sure you have functions or methods for the following operations: (1) determine if it is empty; (2) push a number onto the front; (3) pop a number from the front; (4) push a number onto the back; (5) pop a number from the back; (6) read the number at the front; (7) read the number at the back.
You dont know ahead of time how many numbers there will be, but must do this without using any of the C++ standard collections (like vector).
Important: Use abbreviations to save time.When two functions are very a like, write one in full detail and then describe what must be changed for the other.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started