CS 2 (Winter 2023)

Welcome to CS 2! We’re super excited to have you here this term!


Due Next


Wellness and Inclusion

It is very important to us that you succeed in CS 2. We provide many extra resources to help you. Adam and the TAs hold many office hours, and we have a Ticketing System where you can ask questions asynchronously.

It is also very important to us that you maintain your mental wellness throughout the course. A few points are not worth losing sleep over. Everyone on the course staff is available to chat, and you can always attend office hours for a non-academic conversation if necessary. You can also visit the counseling center if you find you need help beyond the course staff. If you have a temporary health condition or permanent disability (either mental health or physical health related), you should contact accessibility services if you have not already. Additionally, if there is something we can do to make your experience better, please let us know.

Diversity, inclusion, and belonging are all core values of this course. All participants in this course must be treated with respect by other members of the community in accordance with the honor code. If you feel unwelcome or unsafe in any way, no matter how minor, we encourage you to talk to Adam or one of the Deans. We view these sorts of honor code violations as completely unacceptable, and we take them very seriously.


Project Registration Ticketing System Late Tokens Grades

Course Staff


Book an appointment!
Annenberg 115
(626) 395-1765

Teaching Assistants

James Bowden
Snigdha Saha


The following is a list of handouts that you might find helpful throughout the course. We’ve categorized them by when they are useful.


Syllabus – an overview of the course and administrative information

Pair Programming – introduction to pair programming

Collaboration Policy – the course collaboration policy

Week 0

Python2Java ‘Finger’ Exercises – some exercises to help you acclimate to Java coming from a Python world

Java/Python Comparison – a comparison of the basic syntax of Python with Java

Software Setup – instructions on how to get Java, IntelliJ, and git for the course


L00 Wed, Jan 04 Introduction and OOP
Course administrivia. Designing Java classes. Designing data structures. Object oriented programming.
L01 Fri, Jan 06 Problem Decomposition
Using an API. Helper methods. Quadgrams. Log likelihoods. Java String API. Reading documentation.
L02 Mon, Jan 09 Basic Data Structure Trade-Offs
Lists. Sets. Maps. Nested data structures. Efficiency.
L03 Wed, Jan 11 Implementation: ArrayIntList
Arrays. Implementing an ArrayList. Designing a class to fit an API.
L04 Fri, Jan 13 Generics and Implementation: ArrayList
Generics. Java types. Interfaces.
:( Mon, Jan 16 No Class: MLK Day
L05 Wed, Jan 18 Iterators and Implementation: SimpleArraySet, SimpleSortedArraySet
Iterators. Implementing a set. Data structure trade-offs.
L06 Fri, Jan 20 Stacks, Queues, and Implementation: LinkedList
Collections. Stacks. Queues. Nodes. Implementing a linked list.
L07 Mon, Jan 23 The Power of Recursion
L08 Wed, Jan 25 Trees and BSTs
The tree data structure. Binary search trees.
L09 Fri, Jan 27 Tries
The trie data structure.
L10 Mon, Jan 30 Recursive Backtracking
More tries. The recursive backtracking pattern.
L11 Wed, Feb 01 Asymptotic Analysis
How do we measure "efficiency" of code? What does it mean for an algorithm to be "more efficient" than another one?
L12 Fri, Feb 03 Hash Tables I
The hashtable data structure.
L13 Mon, Feb 06 Hash Tables II
More hashtables. Collision resolution. Rehashing.
L14 Wed, Feb 08 Hash Tables III
More hashtables.
L15 Fri, Feb 10 Heaps & Priority Queues I
The heap data structure.
L16 Mon, Feb 13 Heaps & Priority Queues II
The heap data structure, part 2.
L17 Wed, Feb 15 Interlude
L18 Fri, Feb 17 Interlude: P & N Positions and Nim
Combinatorial Game Theory!
:( Mon, Feb 20 No Class: Presidents' Day
L19 Wed, Feb 22 Graphs I: Representation
L20 Fri, Feb 24 Graphs II: DAGs
L21 Mon, Feb 27 Graphs III: Single-Source Shortest Paths
L22 Wed, Mar 01 Sorting
L23 Fri, Mar 03 Partizan Games, Minimax, and Alphabeta
L24 Mon, Mar 06 Alphabeta and Zobrist Hashing
L25 Wed, Mar 08 Monte-Carlo Tree Search
L26 Fri, Mar 10 Victory Lap