Data Structures

Why data structures matter before you chase frameworks

Programs store and retrieve information all day. A data structure is an organized way to hold data so common operations—find, insert, delete, sort—behave predictably. Choosing well is the difference between “works on small tests” and “dies at scale.”

Arrays and lists

An array stores elements in a fixed order with fast index access. Dynamic arrays/lists grow as needed but may resize behind the scenes. Know typical time costs your course expects for lookup and insert at end vs. middle.

Stacks and queues (two everyday patterns)

A stack is last-in, first-out—like a stack of trays (push/pop). A queue is first-in, first-out—like a lunch line (enqueue/dequeue). These show up in parsing, undo features, graph searches, and scheduling stories.

Hash tables (fast lookup with a tradeoff)

A hash function maps keys to buckets. Average lookups can be very fast; collisions (two keys landing together) need a resolution policy your class teaches (chaining vs. open addressing). Understand worst-case stories so you are not surprised on exams.

Trees, especially binary search trees

A tree connects nodes (vertices) with edges; rooted trees use parent/child language. A binary search tree keeps an ordering property: left subtree values are smaller, right subtree values are larger (under the textbook definition). Insert/delete can unbalance the tree—balanced variants like AVL/red-black may appear in honors courses.

Graphs (networks)

Vertices (nodes) and edges model maps, social networks, or dependencies. Know directed vs. undirected, weighted edges, and basic traversals like BFS/DFS—your teacher will name the exact algorithm sheet for quizzes.

Quick review checklist

Run this on paper the night before an assessment—short answers, no peeking.

  • Vocabulary: Five terms, defined in your own words.
  • One strong example: Problem, diagram, quote+context, or map label your rubric would accept.
  • Classic trap: What mistake shows up on every test—and what rule stops it?
  • Connection: One sentence linking this topic to another unit from the same course.