To visit the website for fall quarter's CS106B offering, click here.
Midterm 2 Released
March 12, 2021

Our second midterm exam goes out today. It's due in 47 hours (Sunday, March 14th at 12:30PM Pacific time).

You can do this. Best of luck on the exam!

Assignment 9 Released
March 12, 2021

The last programming assignment of the quarter, Huffman Coding, goes out today. It's due on Friday, March 19th at the start of class (11:30AM Pacific).

In this assignment, you'll implement a compression algorithm using Huffman coding, tying together your knowledge of priority queues, pointers, linked structures, and trees. We hope it's a fitting capstone to the quarter!

This assignment may be done in pairs. Please see our pair programming page for details about working with a partner.

Good luck!

Second Midterm Logistics
March 5, 2021

Our second midterm exam is coming up next week. It's a 48-hour 47-hour take-home exam that goes out on Friday, March 12th at 12:30PM Pacific time and comes due on Sunday, March 14th at 12:30PM. The Pacific time zone enters Daylight Saving Time during the time when the exam is out, so the deadline is only 47 hours after the exam is released, rather than the expected 48. Please check when 12:30PM is on Sunday, March 14th in your local time zone to ensure you submit on time.

For full details about the exam and the exam format, check out the second midterm logistics handout. Note that some of the policies, particularly with regards to style grading, have changed from the first midterm.

We've posted a comprehensive set of practice problems that you can use to prepare for the exam. Each problem here is taken from a past CS106B midterm, and should give you a decent sense of what kinds of questions we've given out before.

Assignment 8 Released
March 5, 2021

Assignment 8: The Adventures of Links, goes out today. It's due on Friday, March 12th at the start of class (11:30AM Pacific).

This assignment is all about linked structures. In the first part, you'll use your skills with the debugger to escape from a maze made of linked cells. In the second, you'll write a set of routines to manipulate DNA strands encoded as linked lists.

This assignment may be done in pairs. Please see our pair programming page for details about working with a partner.

Good luck!

Assignment 7 Released
February 26, 2021

Assignment 7: The Great Stanford Hash-Off, goes out today. It's due on Friday, March 5th at the start of class (11:30AM Pacific).

In this assignment, you'll build two different implementations of a hash table, the first using linear probing and the second using Robin Hood hashing. This will give you a better feel for how different implementation strategies give different efficiencies, and will give you a better glimpse at the sort of creativity that goes into making all our programs run just a bit faster.

This assignment may be done in pairs. Please see our pair programming page for details about working with a partner.

Good luck!

Assignment 6 Released
February 19, 2021

Assignment 6: Data Sagas, goes out today. It's due on Friday, February 26th at the start of class (11:30AM Pacific).

In this assignment, you'll implement your own container type (a priority queue) and use it to build a fast algorithm for finding the best elements in a data stream. You'll also get to see your code in action on real-world data sets.

This assignment may be done in pairs. Please see our pair programming page for details about working with a partner.

Good luck!

Midterm 1 Released
February 12, 2021

Our first midterm exam goes out today. It's due in 48 hours (Sunday, February 14th at 12:30PM Pacific time).

You can do this. Best of luck on the exam!

Assignment 5 Released
February 12, 2021

Assignment 5: Bag'O Big-O, goes out today. It's due on Friday, February 19th at the start of class (11:30AM Pacific).

This assignment explores big-O notation and talks about sorting algorithms along the lines of the ones we saw in class last week. We've intentionally made this assignment much smaller than previous assignments - we know you have a midterm to work on this weekend.

This assignment may be done in pairs. Please see our pair programming page for details about working with a partner.

Good luck!

Midterm Logistics
February 5, 2021

Our first midterm exam is coming up next week. It's a 48-hour take-home exam that goes out on Friday, February 12th at 12:30PM Pacific time and comes due on Sunday, February 14th at 12:30PM.

For full details about the exam and the exam format, check out the midterm logistics handout.

We've posted a comprehensive set of practice problems that you can use to prepare for the exam. Each problem here is taken from a past CS106B midterm, and should give you a decent sense of what kinds of questions we've given out before.

Assignment 4 Released
February 5, 2021

The fourth assignment of the quarter, Assignment 4: Recursion to the Rescue!, goes out today. It's due on Friday, February 12th at the start of class (11:30AM Pacific).

This assignment is designed as a capstone to our treatment of recursive problem-solving. In it, you'll solve a pair of recursive backtracking problems that will give you a sense for just how impressive a technique recursion can be. And, along the way, you'll learn a bunch of useful techniques for debugging recursive code.

This assignment may be done in pairs. Please see our pair programming page for details about working with a partner.

Good luck!

Assignment 3 Released
January 29, 2021

We've just released our next assignment, Assignment 3: Recursion!. It's due on Friday, February 5th at the start of class (11:30AM Pacific). This assignment is all about recursion and recursive problem-solving, and by the time you're done you'll have a much better handle on this amazing technique.

This assignment may be done in pairs. Please see our pair programming page for details about working with a partner.

Good luck!

Assignment 2 Released
January 22, 2020

We've just released our next assignment, Assignment 2: Fun With Collections. It's due on Friday, January 29th at the start of class (11:30AM Pacific). This assignment explores container types and their applications, and once you've finished you'll have some really impressive pieces of software to show off and play around with.

Good luck!

Assignment 1 Released
January 15, 2020

The first programming assignment of the quarter, Assignment 1: Welcome to C++!, goes out today. It's due on Friday, January 22nd at the start of class (11:30AM Pacific). This assignment explores general C++ coding, strings, recursion, debugging, and the Stanford libraries. We hope you have fun with this one!

LaIR shifts will begin this Monday at 5PM Pacific. Feel free to stop by for help! We highly recommend reading our handout about debugging strategies for advice about how to debug your programs and how to ask good questions in the LaIR.

Good luck!

Welcome to CS106B!
January 11, 2021

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 explore fundamental techniques in modeling and solving problems using a variety of programming techniques and evaluating their tradeoffs. By the time you're done with this class, you'll have a firm grasp of problem-solving techniques and will ready to start applying your skills in areas that you genuinely care about.

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 htiek@cs.stanford.edu with questions. If you're wondering whether this is the right class for you, check out our handout with course placement information.

See you soon!

Handouts

Huffman Coding
Second Midterm Logistics
Midterm Logistics
Container Syntax Reference
Python-to-C++ Guide
Assignment Submission Checklist
Debugging Your Code
Honor Code
Course Placement
Course Calendar
Course Information

Section Handouts

Section Handout 8
Section Handout 7
Section Handout 6
Section Handout 5
Section Handout 4
Section Handout 3
  (Solutions)
Section Handout 2
  (Solutions)
Section Handout 1
  (Solutions)

Assignments

Assignment 9: Huffman Coding

Assignment 8: The Adventures of Links Assignment 7: The Great Stanford Hash-Off Assignment 6: Data Sagas Assignment 5: Bag'O Big-O Assignment 4: Recursion to the Rescue! Assignment 3: Recursion! Assignment 2: Fun With Collections Assignment 1: Welcome to C++!

Assignment 0: Welcome to CS106B!

Practice Exams

Midterm 2 Practice Problems
Midterm 1 Practice Problems

Exams

Midterm 2
Midterm 1

Resources

Stanford C++ Library Documentation
C++ Standard Library Documentation
Setting Up Qt Creator
Blank Stanford C++ Project
Blank SimpleTest Project
Assignment Submitter
Working in Pairs
Style Guide
Git Help Session
Git Help Session Slides

Lectures

27: Where to Go from Here
  Slides | Video | Q&A
26: Minimum Spanning Trees
  Slides | Video | Q&A | Code
25: Graphs
  Slides | Video | Q&A
24: Beyond Data Structures
  Slides | Video | Q&A
23: Binary Search Trees, Part II
  Slides | Video | Q&A | Code
22: Binary Search Trees, Part I
  Slides | Video | Q&A | Code
21: Linked Lists, Part III
  Slides | Video | Q&A | Code
20: Linked Lists, Part II
  Slides | Video | Q&A | Code
19: Linked Lists, Part I
  Slides | Video | Q&A | Code
18: Hashing, Part II
  Slides | Video | Q&A
17: Hashing, Part I
  Slides | Video | Q&A | Code
16: Implementing Abstractions, Part II
  Slides | Video | Q&A | Code
15: Implementing Abstractions, Part I
  Slides | Video | Q&A | Code
14: Designing Abstractions
  Slides | Video | Q&A | Code
13: Searching and Sorting, Part II
  Slides | Video | Q&A
12: Searching and Sorting, Part I
  Slides | Video | Q&A
11: Big-O Notation
  Slides | Video 1 | Video 2 | Q&A
10: Recursion, Part V
  Slides | Video | Q&A | Code
09: Recursion, Part IV
  Slides | Video | Q&A | Code
08: Recursion, Part III
  Slides | Video | Q&A | Code
07: Recursion, Part II
  Slides | Video | Q&A | Code
06: Recursion, Part I
  Slides | Video | Q&A | Code
05: Collections, Part III
  Slides | Video | Q&A | Code
04: Collections, Part II
  Slides | Video | Q&A | Code
03: Collections, Part I
  Slides | Video | Code
02: Strings
  Slides | Video | Q&A | Code
01: Functions
  Slides | Video | Q&A | Code
00: Introduction
  Slides | Video | Q&A