CS 2 (Winter 2021)

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 message board called Ed Discussion.

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 Office Hours Queue Late Tokens Grades Discussion Board Zoom

Course Staff


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

Teaching Assistants

Ethan Ordentlich
Adam Abbas
Antonio Caceres
Anya Vinogradsky
Caleb Sander
Charlotte Park
Devin Chotzen-Hartzell
Esmir Mesic
Isha Chakraborty
James Bowden
Jeffrey Ma
Jonathon Corrales de Oliveira
Jyotsna Rao
Matthew Hajjar
Pippa Richter
Ryan Han
Sarah Dunbar
Shwetha Kunnam
Tyrone McNichols
Vignesh Varadarajan


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

Collaboration Policy – the course collaboration policy

Course Policies & Guidelines – an overview how the course will work since we’re online

Exploration Sessions – a list of optional sessions to explore topics the TAs have selected as interesting

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 Mon, Jan 04 Introduction and OOP [ pdf | recording | code ]
Course administrivia. Designing Java classes. Designing data structures. Object oriented programming.
:D Tue, Jan 05 Lab01: Explosive Debugging [ spec ]
Debugging JUnit tests. Prints. The IntelliJ debugger. Breakpoints.
L01 Wed, Jan 06 Problem Decomposition [ code ]
Using an API. Helper methods. Quadgrams. Log likelihoods. Java String API. Reading documentation.
Lab01 (debugging) due @ 11:30 pm on Thu, Jan 07
L02 Fri, Jan 08 Basic Data Structure Trade-Offs [ pdf | recording | code ]
Lists. Sets. Maps. Nested data structures. Efficiency.
L03 Mon, Jan 11 Implementation: ArrayIntList [ recording | code ]
Arrays. Implementing an ArrayList. Designing a class to fit an API.
Project01 (ciphers) due @ 11:30 pm on Mon, Jan 11
:D Tue, Jan 12 Lab02: Adventure Game [ spec ]
Reading stack traces. Using the IntelliJ Visualizer for debugging.
L04 Wed, Jan 13 Generics and Implementation: ArrayList [ recording | code ]
Generics. Java types. Interfaces.
Lab02 (adventure) due @ 11:30 pm on Thu, Jan 14
L05 Fri, Jan 15 Iterators and Implementation: SimpleArraySet, SimpleSortedArraySet [ recording | code ]
Iterators. Implementing a set. Data structure trade-offs.
:( Mon, Jan 18 No Class: MLK Day
Project02 (hangman) due @ 11:30 pm on Mon, Jan 18
:( Tue, Jan 19 No Lab: Mental Health Break!
L06 Wed, Jan 20 Stacks, Queues, and Implementation: LinkedList [ recording | code ]
Collections. Stacks. Queues. Nodes. Implementing a linked list.
L07 Fri, Jan 22 The Power of Recursion [ pdf | recording | code ]
L08 Mon, Jan 25 Trees and BSTs [ pdf | recording ]
The tree data structure. Binary search trees.
Project03 (synthesizer) due @ 11:30 pm on Mon, Jan 25
:D Tue, Jan 26 Lab04: Decision Trees [ spec ]
N-ary trees. Basic machine learning.
L09 Wed, Jan 27 Tries [ recording | code ]
The trie data structure.
Lab04 (decision trees) due @ 11:30 pm on Thu, Jan 28
L10 Fri, Jan 29 Recursive Backtracking [ pdf | recording | code ]
More tries. The recursive backtracking pattern.
L11 Mon, Feb 01 Asymptotic Analysis [ pdf | recording ]
How do we measure "efficiency" of code? What does it mean for an algorithm to be "more efficient" than another one?
Project04 (movies) due @ 11:30 pm on Mon, Feb 01
:D Tue, Feb 02 Lab05: Anagrams [ spec ]
Recursive backtracking.
L12 Wed, Feb 03 Hash Tables I [ pdf | recording ]
The hashtable data structure.
Lab05 (anagrams) due @ 11:30 pm on Thu, Feb 04
L13 Fri, Feb 05 Hash Tables II [ pdf | recording ]
More hashtables. Collision resolution. Rehashing.
L14 Mon, Feb 08 Heaps & Priority Queues [ pdf | recording ]
The heap data structure.
:( Tue, Feb 09 No Lab!
L15 Wed, Feb 10 Interlude: P & N Positions and Nim [ pdf | recording ]
Combinatorial Game Theory!
L16 Fri, Feb 12 Memoization [ pdf ]
Top-down dynamic programming. Memoization tables.
:( Mon, Feb 15 No Class: President's Day
Project05 (markov) due @ 11:30 pm on Mon, Feb 15
:D Tue, Feb 16 Lab07: Grundy's Game [ spec ]
Memoization and Games!
:( Wed, Feb 17 No Class: Blackouts
Lab07 (grundy) due @ 11:30 pm on Thu, Feb 18
L17 Fri, Feb 19 Graphs I: Representation [ pdf | recording ]
L18 Mon, Feb 22 Graphs II: DAGs [ pdf | recording ]
:D Tue, Feb 23 Lab08: Pebbling [ spec ]
Graphs and Games!
L19 Wed, Feb 24 Graphs III: Single-Source Shortest Paths [ pdf ]
Lab08 (pebbling) due @ 11:30 pm on Thu, Feb 25
L20 Fri, Feb 26 Partizan Games and Minimax [ pdf ]
L21 Mon, Mar 01 Alphabeta and Zobrist Hashing [ pdf ]
Project06 (chat) due @ 11:30 pm on Mon, Mar 01
:D Tue, Mar 02 Lab09: DFS [ spec ]
Mazes and DFS!
L22 Wed, Mar 03 Monte-Carlo Tree Search [ pdf ]
Lab09 (dfs) due @ 11:30 pm on Thu, Mar 04
L23 Fri, Mar 05 Parallelism [ pdf ]
L24 Mon, Mar 08 Sorting
:D Tue, Mar 09 Lab10: Steganography [ spec ]
Hiding text in images.
L25 Wed, Mar 10 Victory Lap
Lab10 (steganography) due @ 11:30 pm on Thu, Mar 11
Project07 (maps) due @ 11:30 pm on Fri, Mar 12
Project08 (othello) due @ 11:30 pm on Fri, Mar 12