Skip to Content
The Self-Taught Computer Scientist
book

The Self-Taught Computer Scientist

by Cory Althoff
October 2021
Beginner
224 pages
5h 23m
English
Wiley
Content preview from The Self-Taught Computer Scientist

12Queues

All students should have the opportunity to learn how to program. Computer science is the basis for modern day creativity and expression. The computer programmers of tomorrow will revolutionize medicine.

Anne Wojcicki

A queue is an abstract data type and a linear data structure where you can add items only to the rear and remove them from the front (Figure 12.1). The queue abstract data type describes a data structure that works like the checkout lines at a grocery store: the first person in the line is the first person to check out, and newcomers join the line's rear.

Schematic illustration of in a queue, you add items to the rear and remove them from the front.

Figure 12.1 In a queue, you add items to the rear and remove them from the front.

A queue is an example of a first-in, first-out (FIFO) data structure. As the name implies, in a first-in, first-out data structure, the first item to enter the data structure is the first to come out of it. Queues, like stacks, are limited access data structures.

Queues have two primary operations: enqueueing and dequeueing (Figure 12.2). Enqueueing means adding an item to a queue, whereas dequeueing means removing an item. You enqueue elements to the rear of a queue and dequeue them from the front.

Schematic illustration of the primary operations of queues are enqueueing and dequeueing.

Figure 12.2 The primary operations of queues are enqueueing and dequeueing.

There are several different ways to ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Grokking Algorithms, Second Edition

Grokking Algorithms, Second Edition

Aditya Bhargava
Grokking Algorithms

Grokking Algorithms

Aditya Bhargava

Publisher Resources

ISBN: 9781119724414Purchase Link