Skip to main content
Princeton
Computer Science

Princeton COS 226: Algorithms and Data Structures

COS 226 is Princeton's renowned algorithms and data structures course: sorting, searching, trees and balanced trees, hashing, graphs, and string algorithms, all in Java with rigorous performance analysis. Through the Sedgewick and Wayne book and online course it has a global audience of self-learners alongside Princeton undergraduates.

Fennie is independent and not affiliated with Princeton University. This is an unofficial study guide.

What makes it hard

It moves fast through a lot of classic algorithms, and the bar is implementation plus analysis: you code each data structure and reason precisely about its running time and correctness. Assignments are autograded on both correctness and performance, so an algorithm that works but is too slow fails, and exams test analysis and tracing, not memorized code.

What you'll cover

  • Analysis of algorithms and Big-O
  • Elementary and advanced sorting
  • Priority queues and symbol tables
  • Balanced search trees and hashing
  • Graph algorithms
  • String algorithms

The COS 226 study guide

How to study for Princeton COS 226, step by step.

  1. 1

    Implement each data structure, don't just read it

    COS 226 rewards building the structures yourself. Code each one from the ideas rather than copying, because the assignments and exams test whether you actually understand the mechanics and trade-offs.

  2. 2

    Analyze running time for everything

    Assignments are autograded on performance, not just correctness; a too-slow solution fails. Reason about the running time of every algorithm as you write it, and be ready to justify it on exams.

  3. 3

    Practice tracing algorithms by hand

    Exams test stepping through sorts, tree operations, and graph traversals on paper. Trace each algorithm's state by hand until you can predict its behavior without running it.

  4. 4

    Start performance-sensitive assignments early

    Getting a solution correct is half the work; getting it fast enough is the other half. Begin the day of release so you have time to profile and optimize, not just compile.

Today

Today's COS 226 plan

Preview
65 min

What a Fennie Daily Plan looks like for COS 226. Yours is built from your own syllabus and adapts every day to your deadlines and progress.

0 / 4 done~65m remaining
Keep this plan free

First plan free, no card required. Fennie is independent and unaffiliated with your school.

FAQ

Is COS 226 at Princeton hard?

It's demanding and moves quickly because the bar is implementation plus analysis: you code each data structure and prove it's efficient, and assignments are autograded on performance as well as correctness. Exams test tracing and analysis, so memorizing code doesn't work.

Can I take COS 226 online?

The material is widely available through the Sedgewick and Wayne 'Algorithms' book and its companion online course, so self-learners worldwide use it. You won't earn Princeton credit, but the lectures, exercises, and assignments mirror the on-campus course.

How do I study for COS 226 exams?

Implement each data structure yourself, analyze the running time of everything you write, and practice tracing algorithms by hand, predicting a sort or graph traversal's state without running it. Exams test analysis and tracing, not recall of code.

More Princeton courses