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

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!