Question
In C++ please!!! A queue is a data structure where items can only be added to the end (enqueue) and items can only be removed
In C++ please!!!
"A queue is a data structure where items can only be added to the end (enqueue) and items can only be removed from the front (dequeue).
A queue can easily be implemented as a linked list.
Create a node structure that contains an integer variable and a pointer to the next node.
Write a Enqueue function:
The parameters will be an integer value to add to the list and a Node pointer that points to the head of the list.
Add the new value to the end of the list.
Write a Dequeue function:
It will only have a Node pointer parameter.
It should return the data element that is in the head.
It then needs to delete the head node and update the new head to the next node.
Write a driver program to test the functions.
Every time you Enqueue and Dequeue print out the queue to make sure its working correctly.
Build a Queue that has 5 items.
Demonstrate your Enqueue and Dequeue functions.
You can build your list by using Enqueue.
Bonus (15 pts): Print the queue out each time by using a recursive print function.
Turn in one netid.cpp file. "
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