Course guides

How to Study for Data Structures: A Topic-by-Topic Plan and a 10-Day Final Countdown

Data structures exams ask you to run algorithms by hand, predict what a structure does after a twist, and design for a stated running time. Here's what the course covers, how to practice each topic, and a countdown to the final.

By the Lykke team16 min read

Key takeaways

  • A data structures course covers Big O analysis, linked structures, stacks and queues, sorting, heaps, search trees, hash tables and graph algorithms.
  • Practice the way you're tested: trace every operation on paper, drawing the structure after each step, with no computer.
  • Work out each running time from the input that makes it slowest. A memorized chart fails when the exam changes one detail.
  • Build each structure once from a blank file and test the edge cases: empty, one item, the first and last node.
  • From 10 days out, sort old exam questions by type, take one full old final on paper, and fix every miss by its cause.
In this guide
  1. What a data structures course covers
  2. Why data structures is hard, even after intro programming
  3. How to study for data structures: 6 habits
  4. Data structures important topics: what to practice for each
  5. Worked example: trace a BST and a hash table by hand
  6. How to study for a data structures exam: a 10-day final countdown
  7. AI, collaboration and practice problems
  8. Free resources for data structures and algorithms
  9. FAQ
  10. Sources

Here's how to study for data structures: run every operation by hand on paper until you can predict the result, build each structure once from a blank file, work out each running time from the input that makes it slowest, and take old exams under the real rules. Exams on paper carry a big share of the grade (half of it in Princeton's COS 226), so your practice should look the same.

Below: what a college data structures (and algorithms) course teaches, checked against Princeton's and the University of Washington's fall 2026 course pages, why it catches out students who did fine in intro programming, what to practice for each topic, and a countdown to the final. The Lykke links go to free course pages and interactive demos that open without an account.

Final coming up fast? Go to the 10-day final countdown.

What a data structures course covers

The course goes by CS2, Data Structures, or Algorithms and Data Structures, but the core barely moves. Princeton's COS 226 for fall 2026 runs in this order: union-find, analysis of algorithms, stacks and queues (first with resizable arrays, then with linked lists), elementary sorts, mergesort, quicksort, priority queues, binary search trees, balanced search trees and hash tables. After the October 15 midterm come geometric applications of BSTs, graphs and digraphs, minimum spanning trees, shortest paths and dynamic programming, with reductions, intractability, multiplicative weights and algorithm design listed for the last weeks (COS 226 lectures). The required textbook is Sedgewick and Wayne's Algorithms, 4th edition.

The University of Washington's CSE 373 for autumn 2026 groups the same material four ways (CSE 373 syllabus):

  • Algorithm analysis: big-O, big-Omega and big-Theta.
  • Abstract data types and their implementations: lists, stacks, queues, sets, dictionaries, priority queues and disjoint sets, built from linked lists, arrays, trees, balanced trees such as AVL trees, hash tables and binary heaps.
  • Graphs: graph search, shortest paths and minimum spanning trees.
  • Sorting: comparison sorts such as insertion sort, selection sort and divide-and-conquer sorts, plus sorts that don't compare keys.

Exams carry a lot of the grade. At Princeton the final is worth 30% and the midterm 20%, alongside programming assignments (30%), quizzes (15%) and participation (5%), and the exams are closed-book (COS 226 syllabus). UW's two midterms and final together count for 36%, written homework for 28%, programming projects for 26% and lecture activities for 10%. UW's syllabus even warns that spending 10 hours on a project's "last 2 points" of autograder score might be the quarter's most inefficient use of your time.

Lykke's free Data Structures and Algorithmic Analysis course opens the way Princeton's does, with union-find and Big O, then works through linear structures, binary search trees, balanced trees, sorting and shortest paths, with eight interactive demos along the way. It has no hash table section, so the table below points to another free source for that topic.

What the course assumes you already know

Data structures builds on the first programming course. Princeton's COS 226 requires COS 126 or approval from the COS placement officer. Three intro topics come back early: recursion (trees are recursive), references (a linked list is objects pointing at objects) and resizable lists. If any of those feel shaky, review them in the first two weeks:

AP Computer Science A is a high school course, but College Board lists its college equivalent as a one-semester introductory computer science course, and its Data Collections unit covers ArrayLists, searching and sorting, recursion, binary search and merge sort (College Board). It works as review of the intro material, not as a substitute for the data structures course. If intro programming itself still feels rough, start with our guide to whether intro CS is hard and its practice plan.

Why data structures is hard, even after intro programming

Intro programming mostly asks whether your code runs. Data structures asks whether you can predict what an algorithm will do, say how long it takes, and choose between structures. Two things make that harder than it sounds.

Memorized facts break on a small twist

Researchers gave open-ended data structures questions to 249 students at a final exam study session for a Java-based CS2 course, after 65 think-aloud interviews at three North American universities (Zingaro et al., 2018). Some of what they found:

  • Asked to add a node to the end of a singly linked list that keeps both head and tail references, 67% answered correctly. 16% never updated the tail, and 10% looped through the whole list to find the end, even though the tail reference was right there.
  • On a question about adding larger keys to an existing binary search tree, only 12% chose every correct option. 45% didn't recognize that inserting could take time proportional to N, which the authors say may reflect an assumption that BSTs stay balanced.
  • Choosing a structure for fast lookups by an arbitrary integer index, 22% answered fully correctly. The most popular answer, picked by 24%, named only the binary search tree and missed that binary search on a sorted ArrayList also gives logarithmic lookups. The Binary Search & Tree Morph demo runs the same search on a sorted array and on a balanced BST, side by side.

The authors suggest many of these errors could come from overmemorization: students held on to rules, such as looping to find the last node or treating a BST as the fast choice, instead of reasoning about what the structure would actually do.

The exam is on paper

Princeton's fall 2026 midterm had 9 questions worth 60 points in 80 minutes, closed-book except for one handwritten reference sheet, with no electronic devices (midterm PDF). Its questions included the memory a 2–3 tree node uses, a weighted quick-union diagram, the compares and exchanges a heap insertion makes, the rotations and color flips one red–black tree insertion triggers, matching five sorting algorithms to snapshots of an array partway through sorting, and designing a data type that meets stated worst-case running times. The fall 2025 final had 15 questions in 180 minutes, from listing the edges Kruskal's and Prim's algorithms add, in order, to designing an algorithm under a running-time limit (final PDF).

Other schools test differently. Cornell's CS 2110 study guide for a fall 2024 prelim asks students to write correct Java code, draw node diagrams, analyze complexity and write loop invariants, with no notes, cheat sheet, IDE or API documentation allowed. It also warns that just reading solutions doesn't help you retain the material (CS 2110 study guide).

How to study for data structures: 6 habits

Between exams, Princeton's lecture page suggests a weekly rhythm: skim the textbook section before lecture, read it thoroughly soon after, and complete the matching quiz questions (or the textbook's exercises, if your course has no weekly quizzes). These habits build on that reading.

  1. Trace every operation on paper, start to finish. In a replication study with CS1 students at a large North American research university, code-reading answers worked out with a trace on scratch paper were correct 82.1% of the time, against 60.7% when nothing was sketched, and students who sketched incomplete traces had a low success rate, like those who sketched nothing (Cunningham et al., 2017). That study tested loops and lists in Python, not trees, but the same habit applies: draw the array, the pointers or the tree after every single step. The Memory Architect demo shows an array and a linked list side by side in memory as you access an index, insert at the head and search.
  2. Build each structure once from a blank file. Implement a linked list, a resizing array, a binary heap and a BST without looking at the lecture code. Then test the cases where bugs live: an empty structure, one item, removing the last node, inserting a duplicate. The tail-pointer mistake above is exactly what a three-line test catches.
  3. Write each algorithm as labeled steps. In a semester-long study of 265 intro programming students, the half taught with subgoal-labeled worked examples did better on quizzes. Their exam scores weren't significantly higher, but fewer of them dropped or failed the course (Margulieux, Morrison & Decker, 2020). For an AVL insertion, the labels might read: insert as in a plain BST, update heights on the way back up, find the first unbalanced node, name the case, rotate. Practice it in The Balance Engine.
  4. Derive every running time from the worst input. For each operation, ask which input makes it slowest, then count. Keys inserted in sorted order turn a BST into a chain. Keys that all hash to the same slot turn a hash table lookup into a walk through every key. If you can name the bad input, you can answer the question when the exam changes one detail.
  5. Quiz yourself from a blank page. Once students could produce a foreign-language vocabulary word, more studying of it did nothing for delayed recall, while more testing on it had a large positive effect; the students' predictions of their own performance didn't track their actual scores (Karpicke & Roediger, 2008). With your notes closed, write each structure's invariant (heap order, BST order, the AVL height rule), draw it after five inserts, and state each operation's cost with the reason. Our guide to active recall has more ways to do it.
  6. Mix the topics, and space the reviews. A meta-analysis of 59 studies found a moderate overall benefit for interleaving (Hedges' g = 0.42), a smaller one for math tasks (g = 0.34), and a bigger one when the categories being learned resembled each other; for learning words, blocking did better (Brunmair & Richter, 2019). Many data structures questions look alike, so mixed sets train you to tell a heap question from a BST question. Spread those sessions out, too: our spaced repetition guide covers the research on how far apart to put reviews and how to schedule them.

Data structures important topics: what to practice for each

Follow your syllabus's order. The exam examples come from Princeton's posted COS 226 exams and from the 2018 study above, so treat them as the kinds of questions to expect, not as your exam.

TopicBe able to do on paperWhat exam questions look likePractice it
Big O and analysisCount the work in nested and recursive code; give an order of growth; compare two representationsThe order of growth of a graph loop with adjacency lists, then with an adjacency matrixUnion-Find and Big O Analysis, AP CSA 2.12 Informal Run-Time Analysis as a warm-up
Union-findTrace quick-find, quick-union and weighted quick-union; say what path compression changesWhich arguments to union() would link one root under another, and how big or tall a subtree can beQuick-Find: The Cost of Eagerness, Union-Find & Big O demo
Linked lists, stacks, queues, resizing arraysDraw the pointers after each operation; explain why growing an array by a constant factor, such as doubling, keeps appends cheap on averageWhich list representation supports a set of deque operations in constant worst-case time; add a node at the tailLinear Data Structures, ArrayList growth demo (Java's 1.5x growth, with the amortized cost)
SortingTrace selection, insertion, merge, quick and heap sort; know which are stable and in place; count comparesMatch each algorithm to a snapshot of a partly sorted array; count compares on a given inputSorting Methodologies, Sorting Methodology Lab (selection vs. insertion sort on random, nearly sorted and reversed input)
Priority queues and heapsSwim and sink by hand; find a node's parent and children by array indexWhich inserted values take exactly 3 compares and 2 exchangesThe heap sort part of Sorting Methodologies; the booksite's priority queue chapter
Binary search and BSTsInsert, search and delete; list preorder, inorder and postorder; predict a tree's shape from its insertion orderWhat changes after a run of insertions; fill in a binary search over an increasing and a decreasing arraySearching and Binary Search Trees, Binary Search & Tree Morph
Balanced search treesRun AVL rotations, or 2–3 and red–black insertions, step by stepThe sequence of rotations and color flips one insertion triggersBalanced Search Trees, The Balance Engine
Hash tablesInsert with separate chaining and with linear probing; explain load factor and clusteringThe index where a new key lands in a linear-probing tablebooksite 3.4 Hash Tables, with exercises, some solved
Graphs and shortest pathsRun DFS and BFS, topological sort, Kruskal, Prim and Dijkstra, writing down every relaxationDFS preorder and postorder; the order Kruskal's and Prim's algorithms add edges; distances after the next Bellman–Ford passDirected Graphs and Shortest Paths, Dijkstra Visualization
DesignCombine structures to hit stated running times, then justify each oneA data type whose add and remove run in logarithmic time, with partial credit for slower versionsYour course's old exams

Worked example: trace a BST and a hash table by hand

The same keys, two different trees

Insert 10, 20, 30, 40, 50 into an empty BST. Each key is bigger than everything before it, so each one goes to the right of the last: the tree is a chain of height 4, and finding 50 takes 5 compares. Inserting 60 next would compare it against all five keys.

Now insert the same keys in the order 30, 20, 40, 10, 50. 30 is the root, 20 and 40 are its children, 10 goes left of 20 and 50 goes right of 40. The height is 2, and finding 50 takes 3 compares (30, 40, 50). Same keys, different shape, different cost: the shape depends on insertion order, which is why a plain BST's worst case is linear. To check your drawings, open The Balance Engine, switch to Manual Rotation (it inserts without rebalancing), press Clear and enter each order. Then switch back to Auto-AVL and watch rotations shorten the chain.

A cluster forming in linear probing

Take a table with 7 slots, indexed 0 to 6, with hash(k) = k mod 7.

Insertk mod 7Slots probedLands at
10333
1733, 44
2433, 4, 55
555, 66

Slots 3 to 6 are now one solid run. Any new key that hashes to 3, 4, 5 or 6 walks to the end of the run and wraps around to slot 0. That's clustering, and it's why the load factor matters: the fuller the table, the longer the runs.

How to study for a data structures exam: a 10-day final countdown

Count back 10 days from your own exam date; Princeton's COS 226 final, for example, is on Friday, December 18. Our finals guide covers splitting time across several exams; this countdown is the data structures part of that plan.

Days outWhat you do
10List every topic on the syllabus. Gather old finals and label each question by type: trace, analysis, implementation or design. Find out whether you get a reference sheet.
9–7Trace drills on the topics you're weakest in, with a short mixed warm-up from earlier topics each day. Rebuild your two shakiest structures from a blank file.
6–5For every structure, write each operation's worst-case cost and the input that causes it. Do the design questions from old exams, stating your target running time before you start.
4One full old final, timed, on paper, with only what the real exam allows.
3–2Sort every miss by cause: a slip mid-trace, a broken invariant, a wrong cost or a design gap. Rework each one from a blank page. Finish the reference sheet.
1A short mixed set and your two hardest traces, then stop at a normal hour.

Old exams first, then everything else

Princeton's exams page says solving old exam questions is a good way to prepare and posts years of midterms and finals with solutions (COS 226 exams). It also warns that earlier versions of the course may have covered different topics, so check each question against your own syllabus before you spend time on it. When you run out of your own course's exams, the free course's Final Exam and Course Review section recaps union-find, Big O, sorting, search trees and digraphs, with advice on trace, code-completion and design problems. Its WQUPC Interactive Schematic lets you run weighted quick-union with path compression.

If you get a reference sheet

Princeton's exams allowed one handwritten page: one side for the fall 2026 midterm, both sides for the fall 2025 final. Cornell's prelim allowed none. If you get one, build it on day 10 and trim it on days 3–2. Put the invariants, the cost of each operation with its worst-case input, and the steps of any algorithm you tend to blank on. Choosing what goes on the page is itself a review session.

During the exam

  1. Bank the trace questions first. They're mechanical once you've drilled them, and they leave more time for design.
  2. Write every intermediate state. The tree after each insert, the array after each pass, every distance as it changes. A slip found early costs one step instead of the whole question.
  3. Take the partial credit that's offered. Princeton's design questions spell it out: half credit on a midterm question for a slower version, and 80% or 50% on a final question for slower correct algorithms. A correct slow answer beats a fast idea you can't finish.
  4. State the running time and why. Write the cost of each operation and the line or structure that sets it.

If the final is tomorrow, our one-day exam plan covers triage when there's no time for a countdown.

AI, collaboration and practice problems

Check your syllabus before you paste anything from a data structures course into a chatbot. UW's CSE 373 follows the Allen School's "AI as Reference Tool" policy: you may use AI for general topic questions and ungraded work, but not for anything that counts toward your grade. Students may not submit any assignment problem to an AI, even to ask for similar practice problems for the midterm (CSE 373 syllabus).

The same syllabus encourages discussing specific homework problems with classmates, then sets guardrails: don't refer to anything the collaboration produced while you write what you'll submit, take a 30-minute break before writing it up, and name every collaborator. Its test for the line between collaborating and cheating is whose brain generated what you turned in. Other courses draw the line elsewhere, and the syllabus decides.

Free resources for data structures and algorithms

  • The Algorithms, 4th edition booksite: free excerpts of the text, the Java code, and exercises with solutions to selected ones, organized by the textbook's chapters.
  • Princeton's posted COS 226 exams: midterms and finals with solutions, listed by semester on the exams page linked above.
  • Your own course's old exams and study guides: the closest match to your final.
  • Lykke's free course pages: Data Structures and Algorithmic Analysis for the core topics and AP Computer Science A for intro review in Java.

Frequently asked questions

What is the best way to study for a data structures and algorithms exam?

Practice in the exam's format. Get your course's old exams, label each question as a trace, analysis, implementation or design question, and drill each type on paper with your notes closed. Draw the structure after every step of a trace, and for every operation be ready to say its worst-case cost and the input that causes it. Take at least one full old exam under the real time limit and rules.

What topics are on a data structures final?

Usually algorithm analysis, linked lists, stacks and queues, sorting, priority queues and heaps, binary search trees, balanced trees, hash tables and graph algorithms such as DFS, BFS, minimum spanning trees and shortest paths. Princeton's COS 226 and UW's CSE 373 both list that core for fall 2026. Some courses add dynamic programming or intractability, so check whether your final is cumulative and what your syllabus lists.

Do I need to memorize the Big O of every data structure?

Know the common costs, but don't rely on a memorized chart. Exams often change one detail, such as inserting sorted keys into a BST, and a chart doesn't tell you what happens then. Learn why each operation costs what it does, and which input makes it slowest. If your exam allows a reference sheet, put the costs on it and spend your study time on the reasons.

How do I learn data structures from scratch?

Start with arrays, linked lists, stacks and queues, then move to sorting, heaps, trees, hash tables and graphs, the order most courses use. For each structure, watch or read one explanation, trace its operations by hand, implement it from a blank file and test the edge cases. Then analyze each operation's cost. A free textbook site such as the Algorithms, 4th edition booksite has the code and exercises for every chapter.

Is LeetCode good practice for a data structures class?

It helps with writing code, but it isn't the format most class exams use. Princeton's COS 226 exams, for example, are on paper with no electronic devices, and they ask you to trace algorithms, count compares and design data types to a stated running time. Use your course's old exams and the textbook's exercises first, and add coding-interview problems for extra implementation practice if you have time.

Can I use ChatGPT to study for data structures?

It depends on your syllabus, and some data structures courses are strict. UW's CSE 373 allows AI for general topic questions and ungraded work, but forbids submitting any assignment problem to an AI, even to generate similar practice problems for an exam. If your syllabus is unclear, ask your instructor in writing before you use AI with course material.

Sources

  1. COS 226 Syllabus (Fall 2026) — Princeton University, Department of Computer Science
  2. COS 226 Lectures (Fall 2026) — Princeton University, Department of Computer Science
  3. COS 226 Exams (Fall 2026) — Princeton University, Department of Computer Science
  4. COS 226 Algorithms and Data Structures, Fall 2026 Midterm — Princeton University, Department of Computer Science
  5. COS 226 Algorithms and Data Structures, Fall 2025 Final — Princeton University, Department of Computer Science
  6. CSE 373 Syllabus (Autumn 2026) — University of Washington, Paul G. Allen School of Computer Science & Engineering
  7. CS 2110 Prelim 2 Study Guide (Fall 2024) — Cornell University, Department of Computer Science
  8. Identifying Student Difficulties with Basic Data Structures — ICER '18 (ACM), Zingaro, Taylor, Porter, Clancy, Lee, Nam Liao & Webb, 2018
  9. Using Tracing and Sketching to Solve Programming Problems: Replicating and Extending an Analysis of What Students Draw — ICER '17 (ACM), Cunningham, Blanchard, Ericson & Guzdial, 2017
  10. Reducing withdrawal and failure rates in introductory programming with subgoal labeled worked examples — International Journal of STEM Education, Margulieux, Morrison & Decker, 2020
  11. The Critical Importance of Retrieval for Learning — Science, Karpicke & Roediger, 2008
  12. Similarity matters: A meta-analysis of interleaved learning and its moderators — Psychological Bulletin, Brunmair & Richter, 2019
  13. AP Computer Science A — College Board (AP Students)
  14. Algorithms, 4th Edition (booksite) — Robert Sedgewick and Kevin Wayne, Princeton University
  15. 3.4 Hash Tables — Algorithms, 4th Edition booksite, Sedgewick & Wayne

This guide was researched from the sources above, drafted with AI assistance and checked against those sources before it was published. Dates, deadlines and offers change: check the official page before you act. Found something wrong or out of date? Email support@getlykke.com.

Keep reading

Lykke · the personal assistant for students

One Memory. Every AI.

The free Lykke Chrome extension syncs your Canvas courses into one memory, and ChatGPT, Claude and Muse can answer from your classes and deadlines. It only reads Canvas, it doesn't schedule anything on its own, and it never turns anything in for you.