Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
3rd Edition
ISBN: 9780134038179
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
Question
Book Icon
Chapter 21, Problem 6SA
Program Plan Intro

Linked implementation of queue:

  • A linked list is used to implement a queue and it requires two references to mark two ends of the queue.
  • The first reference is “front” and it is used to mark the head of the list from where the item is removed.
  • The second reference is “rear” and it is used to mark the end of the list from where the items are added to the queue.

  Screenshot of linked implementation of queue

Starting Out with Java: From Control Structures through Data Structures (3rd Edition), Chapter 21, Problem 6SA

  • In the linked list implementation of queue, the front and rear will have same value when there is only one element in the list and also when the queue is empty.

Blurred answer
Students have asked these similar questions
In which scenarios would you prefer to use an array over a linked list, and vice versa?
Java -  Why is it a bad idea to implement a singly linked list version of a queue with the head of the list as the rear of the queue?
Programming language: Java Topic: linked list
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