View on GitHub

Code Fellows reading notes

A repository for organizing notes from my learning.

Stacks and Queues

Source: Code Fellows - Stacks and Queues

Stacks

A stack is a data structure made up of Nodes where each node references the next node but not the previous.

Stack Terms

Stack concepts

FILO: First In Last Out - The first item pushed to a stack will the last item popped.

LIFO: Last In First Out - The last item pushed to a stack will be the first item popped.

Quite literally, imagine stacking values on top of each other like blocks. To remove them, you must start from the top and work your way down.

Stack Complexity

Queues

Queue Terms

Queue Concepts

FIFO: First In First Out

LILO: Last In Last Out

Imagine a line for a roller coaster. The first person to get in line will be the first to board the coaster.

Queue Complexity