Pro lesson · Preview
Stacks & Queues
LIFO stacks and FIFO queues: the two access disciplines behind the call stack, expression evaluation, and ISR-to-main event passing, and how to back each with fixed memory.
22 min read
This lesson is part of Pro
Upgrade to unlock the full lesson and the complete interview Q&A.
Unlock with Pro7 interview questions on this topic
Each one opens a full worked answer.
What's the difference between a stack and a queue?How would you implement a queue efficiently, and what's the naive mistake?Give a concrete embedded use for a stack and one for a queue.What does "peek" do, and why does the distinction from "pop" matter?What bounds must you check on a fixed-capacity stack or queue?An ISR enqueues bytes into a ring-buffer queue and the main loop dequeues them. Do you need a lock?How would you implement a FIFO queue using only two stacks, and what's the cost?
This is just the start
Sign up free to track your progress through this course, mark lessons complete, and work through the full interview Q&A.
More in Data Structures & Algorithms
Time & Space ComplexityArrays & Memory LayoutRing Buffers
Linked Lists
Hash Tables
Static vs Dynamic Allocation