Question: Design and implement a dynamic linked queue (FIFO first-in, first-out) using C++ classes including the following methods: o isEmpty ( ) - returns an integer
Design and implement a dynamic linked queue (FIFO first-in, first-out) using C++ classes including the following methods:
o isEmpty ( ) - returns an integer or enumerated bool type; true for an empty queue, false for non-empty queue
o enqueue ( ) - allocates a node dynamically; initializes it to the data passed in; inserts the node at the tail/e of the queue only; returns true or false for successful or unsuccessful insertion, respectively
o dequeue ( ) - de-allocates a node at the head/front of the queue dynamically; returns the data in the node found at the head/front of the queue; NOTE: some implementations may also return true or false for successful or unsuccessful removal of a node from the head/front
o printQueue ( ) - prints out the data in each node of the queue; may be printed iteratively or recursively
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
