CS 2 (Winter 2023)

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

Announcements

Due Next

Calendar

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.

Tools

Project Registration Ticketing System Late Tokens Grades

Course Staff

Instructor

they/them
Book an appointment!
Annenberg 115
blank@caltech.edu
(626) 395-1765

Teaching Assistants

Hopper
she/her
hopper@
James Bowden
he/him
jbowden@
Snigdha Saha
she/her
snigdha@
Antonio Caceres
he/they
acaceres@
Aditi Chandrashekar
she/her
ajchandr@
Alice Cheng
she/her
aycheng@
Bruno Freeman
he/him
bfreeman@
Devin Chotzen-Hartzell
he/him
dchotzen@
Eshani Patel
she/her
ejpatel@
Enoch Luk
he/him
eluk@
Esmir Mesic
he/him
esmir@
Isha Chakraborty
she/her
isha@
Jon Corrales
he/him
jcorrale@
Jun Hyuk Kwak
he/him
jkwak@
Jia Yue Wu
she/her
jwu7@
Leo Jenkins
he/him
lbjenkin@
Leo Zhang
he/him
lzhang3@
Markus Lendermann
he/him
mlenderm@
Nico Adamo
he/him
nadamo@
Randy Ngo
he/him
randy@
Sahil Azad
he/him
sazad@
Saumya Chauhan
she/her
schauhan@
Sarah Dunbar
she/her
sdunbar@
Winter Pearson
they/them
winter@

Handouts

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

Course

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

Recursion

Recursion Template – a template to help write recursive functions

Schedule

L00 Wed, Jan 04 Introduction and OOP [ pdf | code ]
Course administrivia. Designing Java classes. Designing data structures. Object oriented programming.
L01 Fri, Jan 06 Problem Decomposition [ code ]
Using an API. Helper methods. Quadgrams. Log likelihoods. Java String API. Reading documentation.
L02 Mon, Jan 09 Basic Data Structure Trade-Offs [ code ]
Lists. Sets. Maps. Nested data structures. Efficiency.
Project01 (ciphers) [ guide ] due @ 11:30 pm on Mon, Jan 09
:D Tue, Jan 10 Lab01: Explosive Debugging [ guide ]
Debugging JUnit tests. Prints. The IntelliJ debugger. Breakpoints.
L03 Wed, Jan 11 Implementation: ArrayIntList [ pdf | code ]
Arrays. Implementing an ArrayList. Designing a class to fit an API.
Lab01 (debugging) [ guide ] due @ 11:30 pm on Thu, Jan 12
L04 Fri, Jan 13 Generics and Implementation: ArrayList [ code ]
Generics. Java types. Interfaces.
:( Mon, Jan 16 No Class: MLK Day
Project02 (hangman) [ guide ] due @ 11:30 pm on Mon, Jan 16
:D Tue, Jan 17 Lab02: Adventure Game [ guide ]
Reading stack traces. Using the IntelliJ Visualizer for debugging.
L05 Wed, Jan 18 Iterators and Implementation: SimpleArraySet, SimpleSortedArraySet [ code ]
Iterators. Implementing a set. Data structure trade-offs.
Lab02 (adventure) [ guide ] due @ 11:30 pm on Thu, Jan 19
L06 Fri, Jan 20 Stacks, Queues, and Implementation: LinkedList [ pdf | code ]
Collections. Stacks. Queues. Nodes. Implementing a linked list.
L07 Mon, Jan 23 The Power of Recursion [ pdf | code ]
RECURSION
:( Tue, Jan 24 No Lab!
L08 Wed, Jan 25 Cancelled
L09 Fri, Jan 27 Trees and BSTs [ pdf ]
The tree data structure. Binary search trees.
L10 Mon, Jan 30 Tries [ code ]
The trie data structure.
Project03 (synthesizer) [ guide ] due @ 11:30 pm on Mon, Jan 30
:D Tue, Jan 31 Lab03: Decision Trees [ guide ]
N-ary trees. Basic machine learning.
L11 Wed, Feb 01 Recursive Backtracking [ pdf ]
More tries. The recursive backtracking pattern.
Lab03 (decision trees) [ guide ] due @ 11:30 pm on Thu, Feb 02
L12 Fri, Feb 03 More Recursion
More recursion on trees practice.
L13 Mon, Feb 06 Hash Tables I [ pdf ]
The hashtable data structure.
Project04 (movies) [ guide ] due @ 11:30 pm on Mon, Feb 06
:D Tue, Feb 07 Lab04: Anagrams [ guide ]
Recursive backtracking.
L14 Wed, Feb 08 Hash Tables II [ pdf ]
More hashtables. Collision resolution. Rehashing.
Lab04 (anagrams) [ guide ] due @ 11:30 pm on Thu, Feb 09
L15 Fri, Feb 10 Interlude
Not posted.
L16 Mon, Feb 13 Interlude: P & N Positions and Nim [ pdf ]
Combinatorial Game Theory!
:D Tue, Feb 14 Lab05: Grundy's Game [ guide ]
Memoization and Games!
L17 Wed, Feb 15 Heaps & Priority Queues I [ pdf ]
The heap data structure.
Lab05 (grundy) [ guide ] due @ 11:30 pm on Thu, Feb 16
L18 Fri, Feb 17 Graphs I: Representation [ pdf ]
:( Mon, Feb 20 No Class: Presidents' Day
Project05 (markov) [ guide ] due @ 11:30 pm on Mon, Feb 20
:( Tue, Feb 21 No Lab!
L19 Wed, Feb 22 Cancelled
L20 Fri, Feb 24 Graphs II: DAGs [ pdf ]
L21 Mon, Feb 27 Graphs III: Single-Source Shortest Paths [ pdf ]
Project06 (regalloc) [ guide ] due @ 11:30 pm on Mon, Feb 27
:D Tue, Feb 28 Lab06: Pebbling [ guide ]
Graphs and Games!
L22 Wed, Mar 01 Sorting
Lab06 (pebbling) [ guide ] due @ 11:30 pm on Thu, Mar 02
L23 Fri, Mar 03 Partizan Games, Minimax, and Alphabeta [ pdf ]
L24 Mon, Mar 06 Enrichment 1
:D Tue, Mar 07 Lab07: Mazes [ guide ]
Mazes and DFS!
L25 Wed, Mar 08 Enrichment 2
Lab07 (mazes) [ guide ] due @ 11:30 pm on Thu, Mar 09
L26 Fri, Mar 10 Victory Lap
Project07 (maps) [ guide ] due @ 11:30 pm on Fri, Mar 10
Project08 (othello) [ guide ] due @ 11:30 pm on Thu, Mar 16