Starting Out with C++ from Control Structures to Objects (9th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
9th Edition
ISBN: 9780134498379
Author: Tony Gaddis
Publisher: PEARSON
Question
Book Icon
Chapter 19, Problem 24RQE
Program Plan Intro

Queue:

  • A queue contains sequence of items.
  • The item which is inserted first is retrieved first.
  • Queue performs “First In First Out”.

Operations performed on Queue:

A queue can perform two operations. They are:

  • Enqueue
  • Dequeue

Enqueue:

Insertion of an element into the queue is called as Enqueue. The elements can be inserted at any end of the queue. The sides in which the items are inserted are called as “Rear”.

Dequeue:

Retrieving an element from the queue is known as Dequeue. The sides in which the items are deleted are called as “Front”.

Blurred answer
Students have asked these similar questions
java data structure   Queue: Q4: A program performs the following operations on an empty queue Q: Q.enqueue(24) Q.enqueue(74) Q.enqueue(34) Q.first() Q.dequeue() Q.enqueue(12) Q.dequeue() Please show the queue contents at the end of these operations. Clearly show the front of the queue.
Note : addqueue works like Enqueue and deleteQueue works like Dequeue Consider the following statements: (8, 9) queueType queue; int num; Show what is output by the following segment of code num = 7; queue.addQueue (6); queue.addQueue (num); num = queue.front (); queue.deleteQueue(); queue.addQueue (num + 5); queue.addQueue (14); queue.addQueue (num queue.addQueue (25); queue.deleteQueue (); 2); cout <« "Queue elements: "; while (!queue.isEmptyQueue ()) { cout <« queue.front () << " "; queue.deleteQueue(); } cout <« endl; Queue elements: 14 14 4 25 Queue elements: 11 14 4 4 Queue elements: 11 14 4 25 Queue elements: 11 14 25 25
Explain how a queue works along with the enqueue and dequeue operations with front and rear pointers.

Chapter 19 Solutions

Starting Out with C++ from Control Structures to Objects (9th Edition)

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education