Queue
A queue is a linear data structure that follows First-In-First-Out (FIFO) ordering: elements are added at the rear (enqueue) and removed from the front (dequeue), so the first element inserted is the first one removed. Queues model waiting lines and are fundamental to task scheduling, breadth-first traversal, and…
22 resources across 4 libraries
Glossary Terms(5)
Tree
A tree is a hierarchical, non-linear data structure consisting of nodes connected by edges, with one node designated as the root and every other node having ex…
Graph
A graph is a data structure consisting of a set of nodes (vertices) connected by edges, which may be directed or undirected and weighted or unweighted, used to…
Heap
A heap is a specialized tree-based data structure that satisfies the heap property: in a min-heap, every parent node is less than or equal to its children; in…
Queue
A queue is a linear data structure that follows First-In-First-Out (FIFO) ordering: elements are added at the rear (enqueue) and removed from the front (dequeu…
Stack
A stack is a linear data structure that follows Last-In-First-Out (LIFO) ordering: elements are added and removed from the same end, called the top, so the mos…
Study Notes(5)
Building a Task Queue with RabbitMQ
A hands-on walkthrough of designing a reliable background task queue on RabbitMQ, from queue declaration to acknowledgments and retries.
Mirrored and Quorum Queues
Understand the deprecated classic mirrored queue model and why quorum queues, built on the Raft consensus algorithm, are now the recommended way to achieve hig…
Queues Explained
Understand what a RabbitMQ queue is, how it stores messages, and the properties that control its lifecycle and behavior.
Queue Implementation in C
Learn array-based queue implementation in C with enqueue, dequeue, front/rear pointers, and overflow/underflow handling.
Multilevel Queue Scheduling
How fixed-priority multilevel queues differ from adaptive multilevel feedback queues, and how each handles process movement.
Cheat Sheets(1)
Interview Questions(11)
Difference Between Stack and Queue
A stack is a LIFO (Last In, First Out) structure where the last element added is the first removed, while a queue is a FIFO (First In, First Out) structure whe…
BFS vs DFS: What is the Difference?
BFS (breadth-first search) explores a graph level by level using a queue, while DFS (depth-first search) explores as deep as possible along one path before bac…
What is a Circular Queue?
A circular queue is a fixed-size queue implemented on an array where the last position wraps around to connect back to the first, allowing enqueue and dequeue…
What is Level-Order Tree Traversal?
Level-order traversal visits a binary tree one depth level at a time, left to right, by pushing the root into a FIFO queue and repeatedly dequeuing a node, vis…
How Do You Find the Maximum in Every Sliding Window of Size K?
You solve sliding-window-maximum in O(n) time using a monotonic deque that stores indices in decreasing order of their values, so the front of the deque is alw…
How Would You Implement a Stack Using Queues?
A stack (LIFO) can be built from one or two FIFO queues by rotating the queue after every push so the newest element sits at the front, which makes push O(n) a…
How Would You Implement a Queue Using Stacks?
A queue (FIFO) can be built from two stacks: an 'in' stack absorbs every enqueue in O(1), and an 'out' stack is refilled by popping everything off 'in' and pus…
How Do You Find the Shortest Path in an Unweighted Graph?
The shortest path between two vertices in an unweighted graph is found with breadth-first search (BFS), which explores the graph level by level from the source…
What is Topological Sort and How Does Kahn's Algorithm Work?
Topological sort orders the vertices of a directed acyclic graph so that every edge points from an earlier vertex to a later one, and Kahn's algorithm produces…
What is a Circular Buffer (Ring Buffer)?
A circular buffer (or ring buffer) is a fixed-size array that wraps around on itself, using head and tail indices with modulo arithmetic so that writes and rea…
What is the FIFO Page Replacement Algorithm?
First-In-First-Out (FIFO) page replacement evicts the page that has been resident in memory the longest, regardless of how recently or frequently it has actual…