Computer Science › Foundations of Computer Science

Data Structures I

0 of 18
  1. Binary Trees: Terminology and Representation

    A tree where every node has at most two children — how the graph-theoretic tree from discrete math becomes a concrete node-and-pointer data structure.

    Read →6 sections15 min
  2. Tree Traversals: Preorder, Inorder, Postorder, Level-Order

    Four standard orders for visiting every node in a binary tree exactly once — three defined recursively, one defined by processing level by level with a queue.

    Read →6 sections14 min
  3. Binary Search Trees: Search, Insert, Delete

    A binary tree with an ordering invariant — everything in a node's left subtree is smaller, everything in its right subtree is larger — that turns search into following one path from the root.

    Read →6 sections14 min
  4. BST Performance: Why Balance Matters

    A binary search tree's operations are O(log n) on average but degrade to O(n) on a lopsided tree — the exact problem that motivates the self-balancing trees covered later, in Data Structures II.

    Read →6 sections14 min
  5. Hashing and Hash Functions

    Mapping a key to an array index via a hash function, aiming for near-constant-time lookup — and the properties (determinism, uniformity) a good hash function needs.

    Read →6 sections15 min
  6. Collision Resolution: Open Addressing

    Resolving a collision by probing for the next open slot in the array itself, rather than chaining elsewhere — and the clustering problems that come with it.

    Read →6 sections14 min
  7. Collision Resolution: Separate Chaining

    Resolving two keys that hash to the same index by storing a small list at each array slot — simple to implement, degrading gracefully as collisions accumulate.

    Read →6 sections12 min
  8. Load Factor and Rehashing

    The ratio of stored elements to table capacity, and why a hash table must resize (rehash) once that ratio grows too large to keep operations close to O(1).

    Read →6 sections14 min
  9. Singly Linked Lists

    A sequence built from nodes scattered anywhere in memory, each pointing to the next — trading array's O(1) random access for O(1) insertion at a known position.

    Read →6 sections12 min
  10. Doubly Linked Lists

    A linked list whose nodes also point backward, enabling O(1) removal of a known node and O(1) traversal in either direction, at the cost of an extra pointer per node.

    Read →6 sections11 min
  11. Static Arrays and Random Access

    A fixed-size, contiguous block of memory that supports O(1) access to any element by index — and why that contiguity is exactly what makes random access fast.

    Read →6 sections12 min
  12. Dynamic Arrays and Amortized Resizing

    An array that grows by doubling its capacity when full — and why that doubling strategy makes appending an element O(1) on average (amortized), even though any single append can be O(n).

    Read →6 sections14 min
  13. Arrays vs. Linked Lists: Choosing a Sequence

    Neither structure dominates the other — a side-by-side comparison of access, insertion, deletion, and memory locality to decide which sequence fits a given problem.

    Read →6 sections13 min
  14. The Queue ADT (FIFO)

    A First-In-First-Out structure exposing enqueue and dequeue — and why a naive array implementation needs a circular buffer to keep both operations O(1).

    Read →6 sections14 min
  15. Deques

    A double-ended queue supporting O(1) insertion and removal at both ends — a strict generalization that subsumes both the stack and the queue.

    Read →6 sections15 min
  16. The Stack ADT (LIFO)

    A Last-In-First-Out structure exposing only push and pop — and how the same ADT can be implemented equally well atop a resizing array or a linked list.

    Read →6 sections13 min
  17. Iterators: Traversing a Collection Uniformly

    A uniform way to walk through any collection's elements one at a time without exposing how that collection is actually stored underneath.

    Read →6 sections15 min

Data Structures I

Part of the Computer Science curriculum.

Sort
1

What Is an Abstract Data Type?

The distinction between an Abstract Data Type — what operations a structure supports — and a data structure — how it's actually built in memory to support them.

2

Binary Trees: Terminology and Representation

A tree where every node has at most two children — how the graph-theoretic tree from discrete math becomes a concrete node-and-pointer data structure.

3

Tree Traversals: Preorder, Inorder, Postorder, Level-Order

Four standard orders for visiting every node in a binary tree exactly once — three defined recursively, one defined by processing level by level with a queue.

4

Binary Search Trees: Search, Insert, Delete

A binary tree with an ordering invariant — everything in a node's left subtree is smaller, everything in its right subtree is larger — that turns search into following one path from the root.

5

BST Performance: Why Balance Matters

A binary search tree's operations are O(log n) on average but degrade to O(n) on a lopsided tree — the exact problem that motivates the self-balancing trees covered later, in Data Structures II.

6

Hashing and Hash Functions

Mapping a key to an array index via a hash function, aiming for near-constant-time lookup — and the properties (determinism, uniformity) a good hash function needs.

7

Collision Resolution: Open Addressing

Resolving a collision by probing for the next open slot in the array itself, rather than chaining elsewhere — and the clustering problems that come with it.

8

Collision Resolution: Separate Chaining

Resolving two keys that hash to the same index by storing a small list at each array slot — simple to implement, degrading gracefully as collisions accumulate.

9

Load Factor and Rehashing

The ratio of stored elements to table capacity, and why a hash table must resize (rehash) once that ratio grows too large to keep operations close to O(1).

10

Singly Linked Lists

A sequence built from nodes scattered anywhere in memory, each pointing to the next — trading array's O(1) random access for O(1) insertion at a known position.

11

Doubly Linked Lists

A linked list whose nodes also point backward, enabling O(1) removal of a known node and O(1) traversal in either direction, at the cost of an extra pointer per node.

12

Static Arrays and Random Access

A fixed-size, contiguous block of memory that supports O(1) access to any element by index — and why that contiguity is exactly what makes random access fast.

13

Dynamic Arrays and Amortized Resizing

An array that grows by doubling its capacity when full — and why that doubling strategy makes appending an element O(1) on average (amortized), even though any single append can be O(n).

14

Arrays vs. Linked Lists: Choosing a Sequence

Neither structure dominates the other — a side-by-side comparison of access, insertion, deletion, and memory locality to decide which sequence fits a given problem.

15

The Queue ADT (FIFO)

A First-In-First-Out structure exposing enqueue and dequeue — and why a naive array implementation needs a circular buffer to keep both operations O(1).

16

Deques

A double-ended queue supporting O(1) insertion and removal at both ends — a strict generalization that subsumes both the stack and the queue.

17

The Stack ADT (LIFO)

A Last-In-First-Out structure exposing only push and pop — and how the same ADT can be implemented equally well atop a resizing array or a linked list.

18

Iterators: Traversing a Collection Uniformly

A uniform way to walk through any collection's elements one at a time without exposing how that collection is actually stored underneath.