Data Structures 101

Organizing and Storing Data Efficiently

Core Concepts

Array

A collection of items stored at contiguous memory locations. Think of it as a row of numbered lockers.

Access: Fast (by index)
Size: Fixed (usually)

Stack (LIFO)

Last In, First Out. Like a stack of plates. You add to the top and remove from the top.

Operations: Push (Add), Pop (Remove)

Queue (FIFO)

First In, First Out. Like a line at a grocery store. You join at the back and leave from the front.

Operations: Enqueue (Add), Dequeue (Remove)

Interactive Lab

Use the controls to manipulate the data structures and observe how data is added and removed.

The Stack (LIFO)

Note: Items pile up. The last one added is the first one removed.

The Queue (FIFO)

Note: Items form a line. The first one added is the first one removed.

Real-World Challenge

Read the scenario below and select the best Data Structure to solve the problem.

Loading Scenario...