Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program to implement a queue using linked lists. You can use the queue data structure from the Standard Template Library (STL). The

Write a C++ program to implement a queue using linked lists. You can use the queue data structure from the Standard Template Library (STL).

The program should provide the following functionality:

  • Enqueue data into queue
  • Dequeue data from queue
  • Print data at the front
  • Print data at the back
  • Print the entire queue
  • Check if the queue is empty
  • Print the number of elements in the queue

Test your program using at least the following test cases (considering the queue includes integers):

  1. Check if the queue is empty
  2. Enqueue 7 into the queue
  3. Enqueue 4 into the queue
  4. Check if the queue is empty
  5. Dequeue data form the queue.
  6. Print the number of elements in the queue
  7. Enqueue 5 into the queue.
  8. Print the number of elements in the queue
  9. Check if the queue is empty
  10. Print data at the front
  11. Print data at the back
  12. Print entire queue

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

Step: 3

blur-text-image

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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

2nd Edition

1597499471, 978-1597499477

More Books

Students also viewed these Databases questions