Second Midterm Graded
June 3, 2013

The second midterm exam has been graded. Exams are available for pickup outside of Keith's office (Gates 178), and solutions and statistics are available.

Assignment 7 Out
June 3, 2013

Assignment 7 (Trailblazer) goes out today. It is due on Wednesday, June 12 at 12:15PM. In this assignment, you'll code up some of the fundamental graph algorithms we've explored this quarter (Dijkstra's algorithm, A* search, and Kruskal's algorithm). This is a new assignment, and we hope you have fun with it!

Because this assignment is due when our final exam would normally happen, no late submissions will be accepted and no late days can be used. We will hold extra LaIR hours and office hours during finals week to provide support for this assignment.

Good luck!

Review Session Notes
May 26, 2013

(Dawson here!) I've typed up notes from today's review session and uploaded them to the course website. The notes include code solutions for the five problems I went over today, including comments explaining each step in case you were unable to make the session.

If you have any questions about the notes, the practice midterm, or anything else, I will still be having my office hours tomorrow from 11 am to noon in Gates 160. Feel free to swing by!

Finally, a couple of section leaders have very kindly offered to hold additional midterm-related office hours tomorrow from 1 pm to 3 pm on the second floor of Meyer. Bring any questions you might have!

Second Midterm Logistics
May 22, 2013

The second midterm exam is this upcoming Tuesday, May 28 from 7PM - 10PM. As before, the exam is open-book, open-note, but closed- computer. The exam covers material up through and include Wednesday's lecture on binary search trees.

Midterm locations are divvied up by last name:

  • Aar - Mai: Hewlett 200
  • Mar - Sch: Hewlett 201
  • Sco - Swe: Hewlett 101
  • Sza - Wal: Hewlett 102
  • Wan - Xue: Hewlett 103
  • Yag - Zuo: 380 - 380Y

A practice second midterm is now available. We'll release solutions on Friday. There will be a review session on Sunday, and we'll release more information about it when we get confirmation on the location.

Assignment 5 Out
May 13, 2013

Assignment 5 (Priority Queue) goes out today. It's due on Friday, May 24 at 2:15PM. In this assignment, you'll get to explore different representations for a fundamental data structure - the priority queue - and will hone your skills with dynamic allocation and pointer manipulation.

Good luck!

New Xcode starter projects for Boggle
May 8, 2013

Three new versions of the Xcode starter project have been uploaded for Boggle, each one specific to a different version of OS X. If you have been running into problems getting Boggle to work, try downloading one of the new versions.

Let us know if you run into any additional problems!

Updated Midterm Locations
May 7, 2013

Midterm room assignments have changed. The updated midterm locations are as follows:

  • A - Guo: Nvidia Auditorium
  • Gur - Hu: Huang Engineering Center 018
  • Hw - Nag: Skilling Auditorium
  • Nar - Per: Mitchell Earth Sciences B67
  • Pet - Sei: Thornton 102
  • Sel - Swe: Herrin T195
  • Sza - Ver: 160-314 or 160-315
  • Vij - Xue: 200-217 or 200-219
  • Yag - Zuo: 380-380W

Sorry for the inconvenience - we will make sure that logistics are finalized earlier on for the second midterm!

Midterm Logistics
May 3, 2013

The first CS106B midterm exam will be this upcoming Tuesday, May 7 from 7PM - 10PM. Because there are so many of you, we will be splitting apart the testing location by last name:

  • Information is out of date - see newer announcement.

Dawson will be holding a review session for the midterm this Sunday, May 5 from 7PM - 9PM in 320-105.

Assignment 4 Out
May 3, 2013

Assignment 4 (Boggle) goes out today. It is due on Monday, May 13 at 2:15PM. In this assignment, you'll write a computer program that can play the game of Boggle so well that very, very few people will ever be able to win against it. We hope that you have a lot of fun with this Stanford tradition!

Good luck!

Assignment 3 Out
April 24, 2013

Assignment 3 (Recursion!) goes out today. It is due on Friday, May 3 at 2:15PM. This assignment is a sampler of various recursive problems that is designed to help you build up an intution for different flavors of recursion (procedural, graphical, exhasutive, and backtracking).

Good luck!

Xcode Fix
April 17, 2013

Sadly, there still seem to be some starter code compatibility issues for Xcode users. If you're running into problems getting the Xcode starter projects to compile, try the fix detailed in this handout. This appears to resolve the majority of the issues that students have been seeing.

Assignment 2 Out
April 15, 2013

Assignment 2 (Fun with Collections) goes out today. It is due on Wednesday, April 24 at 2:15PM. In this assignment, you'll get a chance to play around with the collections classes we've seen so far by writing two cool programs - Word Ladders, which finds ways of turning words into one another, and Random Writer, which composes text based on an existing source. We hope you have fun with this assignment!

Starter files are available for download under the "Assignments" section on the right.

Good luck!

Updated Xcode starter project for OS X 10.7 users
April 11, 2013

Since the last iteration of Xcode fixes, we've noticed that a subset of OS X 10.7 users are running into new issues related to "iostream" not being found. If you're running into this problem, try downloading the version of the project specific to OS X 10.7.

Again, sorry for all of the Xcode incompatibilities. Hopefully, this solution will work for the rest of the quarter. Be sure to let us know ASAP if you run into any problems getting the starter projects to work!

Updated MLK-Dream.txt file for VS users
April 9, 2013

Those of you working on the assignment on Windows may have noticed a problem with one of the input text files. If you run the demo using the MLK-Dream.txt input file, it crashes due to the presence of a unicode character (OS X users shouldn't see this problem).

Check out the fixed version of the file here!

Assignment 1 Out
April 5, 2013

Assignment 1 (Welcome to C++!) goes out today. It is due on Monday, April 15 at 2:15PM. This assignment serves as a warmup to the C++ programming language, recursion, and the Stanford C++ libraries. By the time you're done, you'll feel right at home working in C++.

Starter files are available for download under the "Assignments" section on the right.

Good luck!

Welcome to CS106B!
March 30, 2013

Welcome to CS106B! We've got an exciting quarter ahead of us and you're in for a real programming treat. Over the next ten weeks, we'll be exploring the fundamental techniques necessary to reason about, model, and solve big, important problems. It's going to be a lot of fun, and I hope that you're able to join us!

In the meantime, feel free to check out the course information handout and syllabus to learn more about what this class is all about, the prerequisites, and the course policies. If you have any questions in the meantime, feel free to email me at with questions.

See you soon!


00: Course Information
01: Syllabus
02: Course Placement
03W: Running C++ on Windows
03M: Running C++ on Mac
03L: Running C++ on Linux
04: Honor Code
06M: Debugging with Xcode
06W: Debugging with Visual Studio
07: Submitting Assignments
14: Practice Midterm 1
14S: Practice Midterm 1 Solns
17: Midterm 1
17S: Midterm 1 Solutions
21: Practice Midterm 2
21S: Practice Midterm 2 Solns
22: Huffman Encoding
Midterm Review Session Notes
25: Midterm 2
25S: Midterm 2 Solutions
Trailblazer Notes

Section Handouts

Section Handout 1
Section Handout 2
Section Handout 3
Section Handout 4
Section Handout 5
Section Handout 6
Section Handout 7
Section Handout 8


Assignment 1: Welcome to C++!

Assignment 2: Fun with Collections

Assignment 3: Recursion!

Assignment 4: Boggle!

Assignment 5: Priority Queue

Assignment 6: Huffman Encoding

Assignment 7: Trailblazer

Office Hours

Keith (Gates 178)
Tue: 2 PM - 4 PM
Thu: 2 PM - 4 PM

Dawson (Gates 160)
Mon: 11 AM - 12 PM
Tue: 11 AM - 12 PM
Wed: 11 AM - 12 PM
Thu: 11 AM - 12 PM


Course Reader PDF
Tresidder LaIR Office Hours
C and C++ Standard Library Docs
Stanford C++ Library Docs
Good Programming Style 1
Good Programming Style 2
Lecture Videos
Blank Windows Project
Blank Mac Project
Instructions to Fix Xcode
Winter Quarter CS106B Website


00: Introduction
01: Functions in C++
  Slides (code)
02: Strings and Streams
  Slides (code)
03: Collections I
  Slides (code)
04: Collections II
  Slides (code)
05: Collections III
  Slides (code)
06: Collections IV
  Slides (code)
07: Recursion I
  Slides (code)
08: Recursion II
  Slides (code)
09: Recursion III
  Slides (code)
10: Recursion IV
  Slides (code)
11: Recursion V
  Slides (code)
12: Algorithmic Analysis I
13: Algorithmic Analysis II
14: Algorithmic Analysis III
15: Designing Abstractions
  Slides (code)
16: Implementing Abstractions I
  Slides (code)
17: Implementing Abstractions II
  Slides (code)
18: Linked Lists I
  Slides (code)
19: Linked Lists II
  Slides (code)
20: Linked Lists III
  Slides (code)
21: Hashing
  Slides (code)
22: Binary Search Trees
  Slides (code)
23: Beyond Data Structures
24: Graphs
  Slides (code) (data)
25: Shortest Paths
26: Minimum Spanning Trees
27: Where to Go from Here