To visit the website for fall quarter's CS106B offering, click here.
Final Exam Logistics
March 18, 2017

Our final exam is this upcoming Monday, March 20th, from 8:30AM - 11:30AM. Exam locations are divvied up by last (family) name:

  • Abb - Lu : Go to Hewlett 200.
  • Ma  - Sac: Go to Hewlett 201.
  • Sae - Shi: Go to Hewlett 101.
  • Shu - Sun: Go to Hewlett 102.
  • Sur - Tun: Go to Hewlett 103.
  • Ume - Zhu: Go to Shriram 104.

As a reminder, the exam is closed-book, closed-computer, and limited-note. You can bring a single, double-sided sheet of 8.5" × 11" notes to the exam. We'll also provide you with a C++ Library Reference Sheet and Graph Algorithms Reference Sheet that'll be included with the physical copy of the exam.

Best of luck on the final exam!

Assignment 7 Released
March 10, 2017

The final assignment of the quarter, Trailblazer, goes out today. It's due on Friday, March 17th at the start of class. That's the last day of classes, so by university policy we can't accept any late submissions, even if you have remaining late days!

Anton will be holding YEAH hours for this assignment today at 3PM in room 420-041. As always, if you can't make it, we'll post the slides up near the assignment starter files.

Good luck!

Assignment 6 Released
March 3, 2017

Our sixth assignment, Huffman Encoding, goes out today. It's due next Friday, March 10, at the start of class. This assignment must be completed individually and working in pairs is not permitted.

In this assignment, you'll implement Huffman encoding, the compression algorithm we talked about in Wednesday's lecture. We've broken that task down into a number of bite-sized pieces that ultimately culminate in a full compression and decompression function. If you'd like a refresher on Huffman encoding, check out this handy handout on how it works.

Anton will be holding YEAH hours for this assignment today at 3PM in room 420-041. As always, if you can't make it, we'll post the slides up near the assignment starter files.

Good luck!

Assignment 5 Released
February 22, 2017

Our fifth assignment, Priority Queue, goes out today. It's due next Friday, March 3, at the start of class.

This assignment is a four-parter consisting of different implementations of a data type called a priority queue. This is a classic CS106B assignment and is designed to get you thinking about different implementations of data structures, tradeoffs between those representations, and the Fun and Excitement of Pointers!

You are encouraged to work in pairs on this assignment. The problems here require a bit of thought, and it'll be super helpful to have someone to bounce ideas off of. You have plenty of time to complete the assignment, and we recommend that you follow the timetable given on the assignment handout, which has you complete everything with a bit of buffer time to spare.

Good luck!

Midterm Logistics
February 20, 2017

The midterm exam is tomorrow, February 21st. Exam locations are divvied up by last (family) name:

  • Abb - Lam: Go to Hewlett 200.
  • Lee - Nic: Go to Hewlett 201.
  • Ntu - Zhu: Go to Cubberly Auditorium.

As a reminder, the exam is closed-book, closed-computer, and limited-note. You can bring a single, double-sided sheet of 8.5" × 11" notes to the exam. We'll also provide you with a C++ Library Reference sheet that'll be included with the physical copy of the exam. The exam covers material up through and including the two lectures on big-O notation and sorting algorithms, along with topics from Assignments 0 - 4.

Best of luck on the exam!

Assignment 4 Released
February 6, 2017

Our fourth assignment, Recursion to the Rescue!, goes out today. It's due next Friday, February 17th, at the start of class.

This assignment is a four-parter consisting of applications of recursion to real-world problems (hospitals, disaster planning, DNA analysis, and presidential elections), and the unifying theme is the power of recursive backtracking. We're really excited to give this assignment out, and we hope that you have a lot of fun with it!

You are encouraged to work in pairs on this assignment. The problems here require a bit of thought, and it'll be super helpful to have someone to bounce ideas off of. You have plenty of time to complete the assignment, and we recommend that you follow the timetable given on the assignment handout, which has you complete everything with a bit of buffer time to spare.

This evening, Anton will be holding an assignment review session 7PM - 8PM in room 420-041 where he'll talk about different aspects of the assignment. As always, it's highly recommended!

Good luck!

Assignment 3 Released
January 30, 2017

Our third assignment, Recursion!, goes out today. It's due next Monday, February 6th, at the start of class.

This assignment six smaller parts, two of which are optional warm-up exercises and the remaining four of which should be submitted for credit. This is the first assignment of the quarter where you're permitted to work in pairs, so before you get started, we recommend that you read our FAQ about pair programming so that you have a better sense of our polices and how to work effectively.

This evening, Anton will be holding an assignment review session in room 420-040 from 7PM - 8PM where he'll talk about different aspects of the assignment. It's highly recommended, especially if you're feeling a bit shaky about recursion going into the assignment.

Good luck!

Assignment 2 Released
January 23, 2017

Our second assignment, Word Play, goes out today. It's due next Monday, January 30th, at the start of class.

This assignment is a two-parter. The first part, Word Ladders, asks you to write a program that bridges the gap between two words by finding a "ladder" of intermediate words. It's an exercise in breadth-first search and using the different container types strategically. The second, Evil Hangman, is an underhanded program that cheats at Hangman and usually wins. It's an excellent way to get comfortable writing large programs from scratch and to see the power of different collections classes used in different ways.

This evening, Anton will be holding an assignment review session in room 420-041 from 7PM - 8PM where he'll talk about different aspects of the assignment. Highly recommended!

Good luck!

Assignment 1 Released
January 13, 2017

The first programming assignment of the quarter, Assignment 1: Welcome to C++!, goes out today. It's due on Monday, January 23rd at the start of class (11:30AM). 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 6PM (the LaIR will be closed on Sunday for the national holiday). 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 3, 2017

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

16: Assignment Checklist
06: Debugging Advice
03: Honor Code
02: Course Placement
01: Syllabus
00: Course Information

Section Handouts

Section Handout 9
Section Handout 8 | (solutions)
Section Handout 7 | (solutions)
Section Handout 6 | (solutions)
Section Handout 5 | (solutions)
Section Handout 4 | (solutions)
Section Handout 3 | (solutions)
Section Handout 2 | (solutions)
Section Handout 1 | (solutions)

Exams

Final Exam | (Solutions)
Midterm
  Alternate Exam
  Alternate Exam (v2)
Midterm Solutions | (regrade request form)
  Alternate Exam Solutions
  Alternate Exam (v2) Solutions

Practice Exams

Practice Final | (solutions)
Practice Midterm | (solutions)

Assignments

Assignment 7: Trailblazer

Assignment 6: Huffman Encoding

Assignment 5: Priority Queue

Assignment 4: Recursion to the Rescue!

Assignment 3: Recursion!

Assignment 2: Word Play

Assignment 1: Welcome to C++!

Assignment 0: Welcome to CS106B!

Resources

Stanford C++ Library Documentation
C++ Standard Library Documentation
Setting Up Qt Creator
Blank Stanford C++ Project
Assignment Submitter
LaIR Helper Schedule
Working in Pairs
Style Guide
Midterm Reference Sheet
Final Exam Reference Sheet

Lectures

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