Assignment 2 Out, Due December 2, 11:59PM
November 11, 2010

Assignment 2: KDTree goes out today and is due Thursday, December 2 at 11:59PM. I hope that you have as much fun coding it up as I first did. There is a fair amount of starter code for this assignment, which you can find by following the links at the bottom of the page.

Best of luck!

Assignment 1 Due Tonight, 11:59PM
November 9, 2010

Evil Hangman comes due tonight at midnight. I'll be in the LaIR from 6pm to midnight to answer any questions you might have. Best of luck!

Assignment 1 Due Date Now November 9
October 26, 2010

Because the original due date was so close to the CS106B/X midterms, the Evil Hangman assignment is now due on Tuesday, November 9. Hopefully this will make the assignment a bit less stressful.

Assignment 1 Out, Due November 9
October 21, 2010

Assignment 1: Evil Hangman goes out today and is due Tuesday, November 9 at 11:59PM. This assignment has no starter code, though I do provide a dictionary file named dictionary.txt that you should use as the master word list. As always, don't hesistate to email me if you have any questions.

Good luck!

"Growing a Language" Link
October 20, 2010

Guy Steele's lecture "Growing a Language," which I mentioned in lecture yesterday, can be found online at this link. It is an extremely insightful lecture and has enormous comedic value. While not required, I strongly encourage you to watch it. You will not be disappointed.

CityFinder Code Uploaded
October 7, 2010

The code from the CityFinder example from class has been uploaded to the lecture code section. I strongly encourage you to play around with this code - there's a wealth of information here just waiting to be harnessed. If you'd like the original US Census data files, check out

Assignment 0 Out
October 5, 2010

Assignment 0: GraphViz went out today and is due Tuesday, October 19 at 11:59PM. It should be a great way to play around with streams and the STL sequence containers, and I'm hoping that you have a lot of fun with it. The assignment is fairly open-ended once you've gotten the base functionality working, and I'm curious to see what you come up with! Links to the starter code have been posted in the "Assigments" section of this page.

Good luck!

Link to MNIST Database
September 30, 2010

For those of you who are interested, the MNIST Handwritten Digit Database contains all the raw data files that we used in today's machine learning lecture, as well as a whole bunch of links to interesting AI techniques. The data files on the site are in a compressed format that will require you to parse the files byte-by-byte, but if you're interested in learning how to do this just let me know and I can help you out.

I've also posted the code from the lecture, along with a PDF about perceptrons. If you find any cool applications of the code, I'd love to hear about it.

Empty Projects Posted
September 23, 2010

I've posted links to blank VS2008 and Xcode 3.2.3 projects on the course website, which should make it easier for you to play around with the material if you'd like. If you'd like to make your own blank projects, the directions in chapter one of the course reader should help you get started.

A note to Mac users - if you are running Snow Leopard, you should make sure that you have the most recent version of Xcode, which (I believe) is 3.2.3. There is a pretty serious bug in the library implementation in earlrier versions that will cause the lecture code we covered in class to crash unexpectedly. If you do encounter weirdness where the streams library appears to work incorrectly, let me know and I can try to offer some pointers.

Room Change: Now in 260-113
September 23, 2010

CS106L has changed rooms: we are now in room 260-113, which is just across the street from the School of Education. This room is much bigger than where we were on Tuesday and hopefully everyone can get a seat.

See you there!

Welcome to CS106L!
September 19, 2010

Welcome to CS106L! We've got an exciting quarter ahead of us and you're in for a real programming treat. Classes meet Tuesday and Thursday from 4:15 to 5:05 in Educ334 260-113 and I hope you're able to attend. I'll try to stick around afterwards for a little bit to answer questions so you can get the most out of the class.

This class is appropriate for almost anyone who wants to expand his or her knowledge of C++. If you have only a rudimentary background in C++, this class will quickly fill you in on some of the more advanced C++ concepts and syntax along with a solid understanding of the libraries. For those of you with many years of C++ experience, this class will almost certainly cover topics you haven't been exposed to - after all, C++ is an enormous language!


00: Course Information
01: Assignment 0: GraphViz
02: Assignment 1: Evil Hangman
03: Assignment 2: KDTree

Course Reader


Assignment 0: GraphViz
  PC Starter Code
  Mac Starter Code
  Linux Starter Code

Assignment 1: Evil Hangman

Assignment 2: KDTree
  PC Starter Code
  Mac Starter Code
  Linux Starter Code


STL Prioritized Reference
Spring 2010 CS106L Page

Empty VS2008 Project (PC)
Empty Xcode 3.2.3 Project (Mac)

C++ Resources Network
C/C++ Library Reference
Bjarne Stroustrup's C++ Page
CS106B Page
CS106X Page

Lecture Code

0.0: Hello, World!
0.1: Basic cin usage.
0.2: getline examples.
1.0: stringstream examples.
1.1: simpio.h functions.
1.2: Hex viewer.
2.0: STL stack.
2.1: stack time trial.
2.2: push_back time trial.
2.3: push_front time trial.
2.4: Element access time trial.
2.5: Element access time trial, pt II.
3.0: Machine Learning.
4.0: STL iterator basics.
4.1: Basic STL set.
4.2: Bad things to do to a set.
4.3: lower_bound and upper_bound.
4.4: pair examples.
4.5: map examples.
5.0: CityFinder.
6.0: Averaging numbers.
6.1: strutils.h functions.
6.2: Set algorithms.
7.0: Hearts Example.
8.0: Boost lambda/foreach libraries.
8.1: Boost unordered_set.
8.2: Boost assignment library.
9.0: #define errors.
9.1: RickRoll.
9.2: The X Macro Trick.
10.0: Vector, version 1.0.
11.0: Vector, version 2.0.
12.0: Vector, version 3.0.
13.0: Vector, version 4.0.
13.1: ListSet example.
14.0: Vector, version 5.0a.
14.1: Vector, version 5.0b.
15.0: SharedPtr class.
15.1: Copy-on-write Lexicon.
16.0: StringToInteger and exceptions.
17.0: Functor plus count_if.
17.1: Functor time trial.
17.2: Derivative functor.
17.3: Parameter binding [PDF].
17.4: bind2nd plus count_if.
18.0: Regular expression parsing.
19.0: C++0x [PDF].
19.1: References [PDF].


Consecutive Sums (solution)
Marbles in Jars (solution)
String Sorting (coming soon)
C++ Quine (solution)
Prefixes (solution)
next_permutation (solution)
99 Bottles (solution one) (solution two)
Spiral Points
Extendible Array
Random Sampling
Faulty Linked Lists
Walking a Grid
Binary Tree Removal