1. Array
Start your learning journey by understanding the most fundamental data structure.
2. Singly Linked List
Learn in-depth the most fundamental data structure in a programmer's life
6. Queue
Learn about the data structure that powers CPU and disk scheduling algorithms
7. Binary Tree
Learn all about the most critical data structure in computer science
What you will learn
Why FIFO ordering matters in music players, call centers, disk schedulers, and BFS traversal
The four queue properties (capacity, size, front, back) and bounded versus unbounded queues
How modular arithmetic wraps an array queue's back index to reuse dequeued slots
How a tail pointer turns linked list enqueue from an O(N) walk into an O(1) append
How to design a queue from two stacks with O(1) amortised operations
The trade-offs between array-backed and linked list queues across capacity, locality, and memory cost
Why this course
A queue looks like the easiest data structure to build until you try. Enqueue adds to the back, dequeue removes from the front, and both sketch in thirty seconds on a whiteboard. Then an interviewer asks you to implement one on a fixed-size array, and the obvious approach throws away every slot you ever dequeue from.
This course teaches queues by building them. You start with the four use cases that motivate FIFO ordering, then implement a circular array queue and a singly linked list queue from scratch, then walk three design problems where queues and stacks rebuild each other. You finish with five working queue and stack implementations of your own.
Requirements
The course assumes you can read code in any mainstream language and have a working sense of arrays and linked lists.
- Comfort writing loops, conditionals, and classes in at least one language.
- Familiarity with basic Big-O notation (O(N), O(1)).
- A working sense of how arrays and singly linked lists behave, at the level of indexing and pointer chasing.
Overview
A queue is the data structure you reach for whenever the order things arrive in matters more than what they contain. Operating system schedulers, printer spoolers, message brokers like Kafka and RabbitMQ, and the BFS traversal that finds the shortest path in an unweighted graph all rely on the same first-in-first-out rule. Python's deque, Java's Queue, C++'s std::queue, and Go's buffered channels are the same idea dressed up in different syntax: two open ends, with insertion at the back and removal from the front. Once you understand why those two ends move independently, both the implementations and the design problems fall into place.
Representation of a queue
The course covers both halves of the topic: how the queue behaves abstractly, and how to build one in code from a fixed-size array, a singly linked list, and a pair of stacks.
Fundamentals
The course opens with why FIFO ordering deserves a data structure of its own. You see four concrete use cases (music players, call centers, disk schedulers, and printer queues) that all share the same shape: incoming work has to be served in the order it arrived. From there the four queue properties (capacity, size, front, back) and the five supported operations (enqueue, dequeue, front, back, size) are introduced together, so you can reason about complexity before any implementation appears.
The middle of the course is the array implementation. You see why a naive array-backed queue wastes the slots freed by dequeue, and how a circular queue reclaims them by wrapping the back index back to zero using (i + 1) % capacity. Every operation (enqueue, dequeue, front, back, empty, size) is built up one method at a time against the same shared state of arr, frontIndex, backIndex, currentSize, and capacity. By the time you finish this section you can explain why a full queue and an empty queue would otherwise look identical, and how currentSize resolves the ambiguity.
The fundamentals close with the linked list implementation. You see why keeping a tail pointer alongside the head turns enqueue from an O(N) end-of-list walk into an O(1) append, and how maintaining currentSize as a member variable does the same for the size query. By the end of fundamentals you have built two distinct queue implementations behind the same external interface, and you can argue both ways about which one to use in a given situation.
Problem solving
The final section is built around design problems. A design question hands you an empty class skeleton and asks you to implement the queue contract from scratch using a different underlying structure, the same kind of question that appears in nearly every Big Tech onsite that touches data structures.
backIndex with modular arithmetic to reuse slots freed by dequeue, supporting all five queue operations in O(1) time. Design a Queue Using Circular Array.head as the front and tail as the back, giving O(1) enqueue and dequeue and an unbounded capacity that grows with memory. Design a Queue Using Linked List.Every implementation is taught the same way. First you see the structure laid out, then each operation is built up one method at a time against shared state, then the edge cases (empty queue, full queue, single element) are handled explicitly rather than left as exercises. By the end you have written five distinct queue and stack implementations with your own hands, and you understand the trade-off behind each design choice.
How this course is different
Most queue material on the internet either reduces the topic to a one-line FIFO definition or treats the design questions as standalone LeetCode problems. This course handles each on its own terms.
enqueue and dequeue and moves on to BFS.(i + 1) % capacity arithmetic that make an array-backed queue practical.currentSize tracked in a member variable for O(1) size queries.Who this course is for
The course suits anyone who wants to understand queues from the implementation side rather than guess at the design questions.
- New programmers who have used a built-in queue or list but never written
enqueueanddequeuethemselves. - Self-taught and bootcamp graduates who can describe FIFO but freeze when asked to implement a queue on a fixed-size array.
- Working developers who reach for blocking queues, message queues, or task queues at work without knowing how they are built underneath.
- Engineers preparing for FAANG and Big Tech interviews where "design a queue using two stacks" and BFS questions appear in nearly every onsite.
- Returning engineers who learned queues years ago and want a refresher grounded in concrete code rather than abstract definitions.
- Anyone heading into graph and BFS topics who wants queues solid before adding traversal logic on top.
Continue your DSA journey
Queues sit alongside arrays and linked lists as one of the foundational data structures, and they reappear inside graph and design topics later. After this course, the natural next steps depend on what you want to deepen.
- Array: Arrays back the most common queue implementation. The circular queue you build here leans on the same index arithmetic the array course covers in its memory model section. Working through arrays alongside or just before queues makes the modular wrap obvious instead of magical.
- Singly linked list: The other queue implementation. Once you have seen how
headholds the front andtailholds the back, every linked list pattern (fast and slow, reversal, sliding window) feels like the same pointer-chasing skill applied differently. - Doubly linked list: The natural extension of a queue is a deque, where insertion and removal both work at either end. A doubly linked list is the structure that supports it cleanly, and the course also covers reversal and reorder patterns that build on the linked list mental model.
- Stack: Queues and stacks are duals, FIFO versus LIFO, and the design problems in this course (queue from stacks, stack from queues) make the relationship concrete. The stack course teaches the patterns (previous closest, next closest, sequence validation, linear evaluation) that complete the picture.
- Heap: A heap is the structure you reach for when a queue needs to serve items by priority rather than by arrival order. After understanding the regular FIFO queue, the priority queue's behaviour and its O(log N) insertion become a clean contrast.
- Graph: BFS uses a queue to traverse a graph level by level, and the shortest-path-on-an-unweighted-graph pattern is mostly a queue-driven loop. Doing queues first makes the BFS implementation in the graph course feel like a small step rather than a whole new idea.
Frequently asked questions
deque, Java's Queue, and C++'s std::queue map onto the same internal machinery.for loop in any language and read Big-O notation like O(N), you have everything you need. A working sense of arrays and singly linked lists helps but is not required.frontIndex forward and leaves the old cell unused. Once backIndex reaches the last cell of the array, the queue refuses to enqueue even though empty slots are sitting unused at the start. A circular queue fixes this by wrapping backIndex (and frontIndex) back to zero with (i + 1) % capacity, so dequeued slots get reused instead of leaking. Without the wrap, the queue's effective capacity shrinks by one for every dequeue ever performed.