Don't forget to fill out the mid-quarter evaluation at! Your comments really make a difference!


Assignment 2 Out
May 20, 2010

Assignment 2: KDTree went out today and is due on Thursday, June 3 at 11:59PM. I'm really hoping that it's as fun and exciting for you to implement as it was to design. As always, don't hesitate to email me with comments or questions.

Vector Complete!
May 18, 2010

After five lectures, we've finally finished up a slick implementation of the vector abstraction. I've posted two versions of the code from lecture - one using the traditional method of writing a copy constructor and assignment operator, and one using the copy-and-swap idiom. If we have time later in the quarter, we may revisit the vector in the context of low-level memory allocation, but if not, I hope you've learned a lot from the successive iterations.

I'm currently working on finishing up the assignment handout and starter code for Assignment 2, so the course reader chapter on copy functions isn't quite ready yet. I'll try to get it posted as soon as possible.

Midquarter Evaluation Form
May 4, 2010

The midquarter evaluation form is available online. This is your chance to let us know how we're doing and what we can do to improve the course. We do take feedback seriously, and it will only take a few minutes of your time to fill out. All comments are purely anonymous.

"Growing a Language" Link
April 27, 2010

Guy Steele's lecture "Growing a Language," which I mentioned in lecture today, 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.

Assignment 0 Due, Assignment 1 Out
April 22, 2010

Assignment 1: Evil Hangman went out today and is due on Thursday, May 6 at 11:59PM. It should be a great way to play around with the STL container classes and the streams library, and I hope you have a lot of fun writing it.

Assignment 0 is due tonight at 11:59PM. I will be in the LaIR from 8 - 12 tonight if you have any questions.

CityFinder Code Uploaded
April 19, 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

The programming puzzle from last lecture is also available if you want to take a stab at it.

Assignment 0 Out
April 8, 2010

Assignment 0: SendMail went out today and is due on Thursday, April 22 at 11:59PM. I hope that you have a lot of fun with this assignment and get a chance to hone your C++ savvy. As always, if you have any questions on the assignment, let me know and I'll try to respond ASAP.

Welcome to CS106L!
March 29, 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 Educ 128 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: SendMail
02: Assignment 1: Evil Hangman
03: Assignment 2: KDTree

Course Reader


Assignment 0: SendMail
  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

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

Lecture Code

0.0: Hello, World!
0.1: Basic cin usage.
0.2: getline examples.
0.3: stringstream examples.
1.0: GetInteger implementation.
1.1: Hex viewer.
2.0: Basic 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, part 1.
2.5: Element access time trial, part 2.
3.0: Machine learning example.
3.1: Machine learning example [PDF].
4.0: Basic STL set.
4.1: Basic STL map.
5.0: CityFinder
6.0: Averaging numbers.
6.1: strutils.h functions.
6.2: Set algorithms
7.0: Hearts example.
8.0: Boost lambda and foreach libraries.
8.1: Boost unordered library.
8.2: Boost assign library.
9.0: #define errors.
9.1: RickRoll.
9.2: The X Macro Trick.
10.0: Vector class, version 1.0.
11.0: Vector class, version 2.0.
12.0: Vector class, version 3.0.
13.0: Vector class, version 4.0.
13.1: ListSet class.
14.0: Vector class, version 5.0a.
14.1: Vector class, version 5.0b.
15.0: count_if plus a functor.
15.1: Functor time trial.
15.2: Derivative functor.
15.3: bind2nd example.
16.0: SharedPtr example.
17.0: Template Metaprogramming [PDF].
18.0: C++0x [PDF].
18.1: References [PDF].


C++ Quine (solution)
Recursion (solution)
99 Bottles (solution 1) (solution 2)
Prefixes (solution)
Integer Partitions
String Reversing
Min-Cost Paths
Code Beauty Pageant
Linked List Sampling
Binary Tree Removal