Fundamentals · Level 2

Data Structures

Choosing the right data structure is often the whole game — the same problem can be trivial or hopeless depending on how you store the data. A stack, a queue and a hash table each make certain operations effortless and others awkward, and knowing which is which is exactly what coding interviews probe. This set drills the classic structures, their access rules (LIFO, FIFO) and the one thing each is especially good at.

Practice this set for free — no account needed. Loads 15 flashcards into the learner.

Practice in the free learner

How to study this set

For every structure, memorise its defining rule and its standout operation: a stack is LIFO and pushes/pops from one end; a hash table trades memory for average O(1) lookup. Sketch each one as boxes and arrows on paper — the picture recalls faster than the words.

All 15 flashcards

What is an array?

A collection of elements stored in indexed positions and accessed by index

Accessing an element by its index takes constant time, O(1).

What is a stack?

A last-in, first-out (LIFO) collection: you add and remove from the same end (push and pop)

What is a queue?

A first-in, first-out (FIFO) collection: you add at one end and remove from the other (enqueue and dequeue)

What is a linked list?

A sequence of nodes where each node holds a value and a reference to the next node

What is a hash table (hash map / dictionary)?

A structure that maps keys to values using a hash function, giving fast lookup by key

Average lookup, insertion and deletion are O(1).

What is a tree?

A hierarchical structure of nodes with a single root and no cycles

What is a binary tree?

A tree in which each node has at most two children

What is a graph?

A set of nodes (vertices) connected by edges

Which principle does a stack follow?

LIFO — last in, first out

Which principle does a queue follow?

FIFO — first in, first out

What is a “node” in a data structure?

A basic unit that holds data and links to other nodes

In a hash table, what is it called when two keys map to the same slot?

A collision

Collisions are resolved with techniques such as chaining or open addressing.

What is the “root” of a tree?

The topmost node, which has no parent

What is a binary search tree (BST)?

A binary tree where each node’s left subtree holds smaller keys and its right subtree holds larger keys

This ordering allows fast, O(log n) search when the tree is balanced.

What is the main advantage of a hash table for lookups?

Average constant-time, O(1), access by key

What to learn next

You know how to store data; the last step is reasoning about speed. Level 3 covers Big-O notation and the complexity of the searches and sorts you will run on these structures.

Continue to Level 3: Algorithms & Big-O →