Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions