• 12 Pages Midterm #1 Spring 2013
    Midterm #1 Spring 2013

    School: Stanford

    Course: Programming Abstractions

    CS106B Spring 2013 Handout #17 May 7, 2013 CS106B Midterm Exam #1 This midterm exam is open-book, open-note, but closed-computer. Answer each of the questions included in the exam. Write all of your answers directly on the examination paper, including any

  • 5 Pages Practice Final Fall 2012 Solutions
    Practice Final Fall 2012 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS106B Handout 40S December 4th, 2012 Autumn 2012 CS106B Practice Final Solution Solution 1: Linked Lists a. static Map<string, string> concatenateMaps(const node *maplist) cfw_ Map<string, string> concatenations; for (const node *curr = maplist; curr !=

  • 7 Pages Practice Final #2 Winter 2013 Solutions
    Practice Final #2 Winter 2013 Solutions

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS106B Handout #54A March 13, 2013 Answers to Practice Final Examination #2 Review session: Scheduled finals: Sunday, March 17, 3:005:00 P.M. (Hewlett 200) Tuesday, March 19, 12:153:15 P.M. (Hewlett 200) Thursday, March 21, 12:153:15 P.M. (He

  • 9 Pages Practice Midterm #1 Spring 2013 Solutions
    Practice Midterm #1 Spring 2013 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS106B Spring 2013 Handout #17S May 3, 2013 CS106B Practice Midterm Exam #1 Solutions Problem One: Detecting Gerrymandering (35 Points) The simplest solution to this problem is simply to count up how many districts were won, along with the total number of

  • 4 Pages Practice Midterm #1 Summer 2014 Solutions
    Practice Midterm #1 Summer 2014 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #1 ANSWER KEY 1. C+ Basics / Parameters 9 -3 -7 9 5 -7 5 10 1 7 3 -2 -6 2. File I/O and Strings (write) As with any programming problem, there are many correct solutions. Here is one: void wordStats(string filename) cfw_ ifst

  • 8 Pages Practice Midterm #1 Summer 2014
    Practice Midterm #1 Summer 2014

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #1 This sample exam is intended to demonstrate an example of some of the kinds of problems that will be asked on the actual midterm exam. We do not guarantee that the number of questions in this sample exam will match the num

  • 10 Pages Practice Midterm #1
    Practice Midterm #1

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #1 This sample exam is intended to demonstrate an example of some of the kinds of problems that will be asked on the actual midterm exam. We do not guarantee that the number of questions in this sample exam will match the num

  • 7 Pages Practice Midterm #1 Spring 2013
    Practice Midterm #1 Spring 2013

    School: Stanford

    Course: Programming Abstractions

    CS106B Spring 2013 Handout #14 May 1, 2013 Practice CS106B Midterm Exam This handout is intended to give you practice solving problems that are comparable in format and difficulty to the problems that will appear on the midterm examination on Tuesday, May

  • 6 Pages Practice Midterm #1 Winter 2013
    Practice Midterm #1 Winter 2013

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS106B Handout #23 January 28, 2013 Practice Midterm Exam #1 Review session: Sunday, February 3, 7:009:00 P.M., Hewlett 201 (next door) Midterm #1: Tuesday, February 5, 3:155:15 P.M., Braun Auditorium (Chemistry) Midterm #2: Tuesday, February

  • 7 Pages Practice Midterm #2 Spring 2013 Solutions
    Practice Midterm #2 Spring 2013 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS106B Spring 2013 Handout #22S May 24, 2013 Practice Second Midterm Exam Solutions _ Based on handouts by Eric Roberts and Jerry Cain Problem One: Reversing a Queue One way to reverse the queue is to keep moving nodes out of the list one at a time to the

  • 4 Pages Practice Midterm #2 Solutions
    Practice Midterm #2 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #2 ANSWER KEY 1. C+ Basics / Parameters yo2 - hi1 bye2 - yo1 hi12 - bye1 hi1 bye1 yo1 !hi12 2. File I/O and Strings (write) As with any programming problem, there are many correct solutions. Here is one: void flipLines(string

  • 7 Pages Practice Midterm #2 Spring 2013
    Practice Midterm #2 Spring 2013

    School: Stanford

    Course: Programming Abstractions

    CS106B Spring 2013 Handout #21 May 22, 2013 Practice Second Midterm Exam _ Based on handouts by Eric Roberts and Jerry Cain This handout is intended to give you practice solving problems that are comparable in format and difficulty to the problems that wi

  • 3 Pages Practice Midterm #2 Summer 2014 Solutions
    Practice Midterm #2 Summer 2014 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #2 ANSWER KEY 1. C+ Basics / Parameters yo2 - hi1 bye2 - yo1 hi12 - bye1 hi1 bye1 yo1 !hi12 2. File I/O and Strings (write) As with any programming problem, there are many correct solutions. Here is one: void flipLines(string

  • 8 Pages Practice Midterm #2 Summer 2014
    Practice Midterm #2 Summer 2014

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #2 This sample exam is intended to demonstrate an example of some of the kinds of problems that will be asked on the actual midterm exam. We do not guarantee that the number of questions in this sample exam will match the num

  • 10 Pages Practice Midterm #2
    Practice Midterm #2

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #2 This sample exam is intended to demonstrate an example of some of the kinds of problems that will be asked on the actual midterm exam. We do not guarantee that the number of questions in this sample exam will match the num

  • 4 Pages Practice Midterm #1 Winter 2013 Solutions
    Practice Midterm #1 Winter 2013 Solutions

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS106B Handout #23A January 30, 2013 Answers to Practice Midterm Exam #1 Review session: Sunday, February 3, 7:009:00 P.M., Hewlett 201 (next door) Midterm #1: Tuesday, February 5, 3:155:15 P.M., Braun Auditorium (Chemistry) Midterm #2: Tuesd

  • 4 Pages Practice Midterm #2 Winter 2013 Solutions
    Practice Midterm #2 Winter 2013 Solutions

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS106B Handout #25A February 1, 2013 Answers to Practice Midterm Exam #2 Review session: Sunday, February 3, 7:009:00 P.M., Hewlett 201 (next door) Midterm #1: Tuesday, February 5, 3:155:15 P.M., Braun Auditorium (Chemistry) Midterm #2: Tuesd

  • 7 Pages Practice Final #1 Winter 2013 Solutions
    Practice Final #1 Winter 2013 Solutions

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS106B Handout #52A March 11, 2013 Answers to Practice Final Examination #1 Review session: Scheduled finals: Sunday, March 17, 3:005:00 P.M. (Hewlett 200) Tuesday, March 19, 12:153:15 P.M. (Hewlett 200) Thursday, March 21, 12:153:15 P.M. (He

  • 9 Pages Practice Final Fall 2012
    Practice Final Fall 2012

    School: Stanford

    Course: Programming Abstractions

    CS106B Handout 40 December 4th, 2012 Autumn 2012 CS106B Practice Final Exam Facts: When: Where: Friday, December 14th from 12:15 3:15 p.m. Last Names A through Kh: Building 320, Room 105 Last Names Ki through Z: Building 420, Room 040 Coverage The closed

  • 8 Pages Midterm #1 Spring 2013 Solutions
    Midterm #1 Spring 2013 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS106B Spring 2013 Handout #17S May 13, 2013 CS106B Midterm Exam #1 Solutions Below is the score distribution for the first midterm exam: 140 120 100 80 60 40 20 0 0 80 81 100 101 120 121 140 141 160 161 180 Overall, the final statistics were as follows:

  • 15 Pages Midterm #2 Spring 2013
    Midterm #2 Spring 2013

    School: Stanford

    Course: Programming Abstractions

    CS106B Spring 2013 Handout #25 May 28, 2013 CS106B Midterm Exam #2 This midterm exam is open-book, open-note, but closed-computer. Answer each of the questions included in the exam. Write all of your answers directly on the examination paper, including an

  • 5 Pages Midterm Summer 2014 Solutions
    Midterm Summer 2014 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS 106B Summer 2014 Midterm Exam ANSWER KEY 1. C+ Basics / Parameters (read) dx cx 21 2 cxx zx 301 22 zxx cxx 2 302 2 21 301 cxx zxx zx 2. File I/O and Strings (write) int printMostCommonName(ifstream& input) cfw_ int uniqueNames = 1; / counters for names

  • 7 Pages Midterm Winter 2014 Solutions
    Midterm Winter 2014 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS 106B Winter 2014 Midterm Exam ANSWER KEY 1. C+ Basics / Parameters (read) 4 0xdd00 7 12 6 0xff00 9 15 8 0xbb00 11 17 17 15 9 11 2. File I/O and Strings (write) / short-n-sweet solution void printBox(string filename, int width) cfw_ ifstream input; inpu

  • 12 Pages Midterm Spring 2014
    Midterm Spring 2014

    School: Stanford

    Course: Programming Abstractions

    Page 1 of 12 CS106B Instructor: Cynthia Lee Spring 2014 May 8, 2014 MIDTERM EXAM NAME (LAST, FIRST): _ SUNET ID: _@stanford.edu_ SECTION LEADERs NAME: _ Problem 1 Topic ADTs 2 Pointers & Memory 3 Recursion 4 Short Answer TOTAL 30 120 Score Possible 30 30

  • 11 Pages Midterm Spring 2014 Solutions
    Midterm Spring 2014 Solutions

    School: Stanford

    Course: Programming Abstractions

    Page 1 of 11 CS106B Instructor: Cynthia Lee Spring 2014 May 8, 2014 MIDTERM EXAM NAME (LAST, FIRST): _ SUNET ID: _@stanford.edu_ SECTION LEADERs NAME: _ Problem 1 Topic ADTs 2 Pointers & Memory 3 Recursion 4 Short Answer TOTAL 30 120 Score Possible 30 30

  • 13 Pages Midterm Summer 2014
    Midterm Summer 2014

    School: Stanford

    Course: Programming Abstractions

    CS 106B, Summer 2014 Midterm Exam, Monday, July 21, 2014 Your Name: _ Section Leader: _ Honor Code: I hereby agree to follow both the letter and the spirit of the Stanford Honor Code. I have not received any assistance on this exam, nor will I give any. T

  • 10 Pages Practice Final #1 Summer 2014 Solutions
    Practice Final #1 Summer 2014 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Final Exam #1 ANSWER KEY 1. Pointers (write) list2->next->next->next = list; list->next = list2; list = list2->next->next; list2 = list2->next; list2->next = NULL; list->next->next->next = NULL; / / / / / / 4 -> 1 1 -> 2 list -> 4 list2 -

  • 15 Pages Midterm Winter 2014
    Midterm Winter 2014

    School: Stanford

    Course: Programming Abstractions

    CS 106B, Winter 2014 Midterm Exam, Tuesday, February 18, 2014 Your Name: _ Section Leader: _ Honor Code: I hereby agree to follow both the letter and the spirit of the Stanford Honor Code. I have not received any assistance on this exam, nor will I give a

  • 10 Pages Practice Final #1 Summer 2014
    Practice Final #1 Summer 2014

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Final Exam #1 This sample exam is intended to demonstrate an example of some of the kinds of problems that will be asked on the actual final exam. We do not guarantee that the number of questions in this sample exam will match the number

  • 5 Pages Midterm Winter 2013 Solutions
    Midterm Winter 2013 Solutions

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS106B Handout #33 February 11, 2013 Answers to Midterm Exam Congratulations! As a class, you knocked this one out of the park. We believed the exam to be fair but not unduly easy, so most of you can take real pride in doing so well. Given th

  • 10 Pages Practice Final #2 Summer 2014 Solutions
    Practice Final #2 Summer 2014 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Final Exam #2 ANSWER KEY 1. Pointers (read) Here are three working solutions: list->next->next->next = temp; temp->next->next = list->next->next; list->next->next = NULL; ListNode* temp2 = temp->next; temp->next = list->next; list = temp2

  • 11 Pages Practice Final #1 Winter 2013
    Practice Final #1 Winter 2013

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS106B Handout #52 March 8, 2013 Practice Final Examination Review session: Scheduled finals: Sunday, March 17, 3:005:00 P.M. (Hewlett 200) Tuesday, March 19, 12:153:15 P.M. (Hewlett 200) Thursday, March 21, 12:153:15 P.M. (Hewlett 200) Pleas

  • 10 Pages Practice Final #2 Summer 2014
    Practice Final #2 Summer 2014

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Final Exam #2 This sample exam is intended to demonstrate an example of some of the kinds of problems that will be asked on the actual final exam. We do not guarantee that the number of questions in this sample exam will match the number

  • 5 Pages Practice Midterm #1 Solutions
    Practice Midterm #1 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #1 ANSWER KEY 1. C+ Basics / Parameters 9 -3 1 -7 9 6 5 -7 2 5 9 -3 0xcc00 0xbb00 0xdd00 -7 2. File I/O and Strings (write) As with any programming problem, there are many correct solutions. Here is one: void wordStats(string

  • 8 Pages Practice Final #2 Winter 2013
    Practice Final #2 Winter 2013

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS106B Handout #54 March 11, 2013 Practice Final Examination #2 Review session: Scheduled finals: Sunday, March 17, 3:005:00 P.M. (Hewlett 200) Tuesday, March 19, 12:153:15 P.M. (Hewlett 200) Thursday, March 21, 12:153:15 P.M. (Hewlett 200) 1

  • 4 Pages Practice Midterm #3 Solutions
    Practice Midterm #3 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #3 ANSWER KEY 1. C+ Basics / Parameters 0 2 8 8 3 7 8 7 1 8 9 2 9 2. File I/O and Strings (write) As with any programming problem, there are many correct solutions. Here is one: void coinFlip(string filename) cfw_ ifstream in

  • 6 Pages Practice Midterm #2 Winter 2013
    Practice Midterm #2 Winter 2013

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS106B Handout #25 January 30, 2013 Practice Midterm Exam #2 Review session: Sunday, February 3, 7:009:00 P.M., Hewlett 201 (next door) Midterm #1: Tuesday, February 5, 3:155:15 P.M., Braun Auditorium (Chemistry) Midterm #2: Tuesday, February

  • 10 Pages Practice Midterm #3
    Practice Midterm #3

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #3 This sample exam is intended to demonstrate an example of some of the kinds of problems that will be asked on the actual midterm exam. We do not guarantee that the number of questions in this sample exam will match the num

  • 3 Pages 08-CollectionClasses1
    08-CollectionClasses1

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #8 January 12, 2015 Collection Classes (Part 1) Outline Collection Classes 1. Introduce the idea of collection classes (Part 1: Vectors, Grids, Stacks, and Queues) 2. Introduce the Vector class 3. Use vectors to read an entire

  • 3 Pages 11-DesigningClasses
    11-DesigningClasses

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #11 January 16, 2015 Designing Classes Optional Movie Classes and Objects Eric Roberts CS 106B January 16, 2015 Outline 1. Anagram exercise from last time 2. Structures 3. Representing points using a structure 4. Classes and o

  • 3 Pages 15-Section2
    15-Section2

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #15 January 21, 2015 Section Handout #2ADTs Problem 1. Using grids (Chapter 5, exercise 10, page 252) In the game of Minesweeper, a player searches for hidden mines on a rectangular grid that mightfor a very small boardlook li

  • 2 Pages 10-CollectionClasses2
    10-CollectionClasses2

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #10 January 14, 2015 Collection Classes (Part 2) Optional Movie Collection Classes (Part 2: Maps, Sets, and Lexicons) Eric Roberts CS 106B January 14, 2015 And so even though we face the difficulties of today and tomorrow, I s

  • 3 Pages 14-RecursiveStrategies
    14-RecursiveStrategies

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #14 January 21, 2015 Recursive Strategies Recursion Recursive Strategies Eric Roberts CS 106B January 21, 2015 One of the most important Great Ideas in CS 106B is the concept of recursion, which is the process of solving a pr

  • 8 Pages 18-Assignment3
    18-Assignment3

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS106B Handout #18 January 26, 2015 Assignment #3Recursion Parts of this handout were written by Julie Zelenski and Jerry Cain. Due: Wednesday, February 4 YEAH Hours: Wednesday, January 28, 7:00-9:00 P.M., Braun Auditorium This weeks assignme

  • 3 Pages 17-BacktrackingAndGames
    17-BacktrackingAndGames

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #17 January 26, 2015 Backtracking and Games Searching in a Branching Structure The recursive structure for finding the solution path in a maze comes up in a wide variety of applications, characterized by the need to explore a

  • 4 Pages 19-Section3
    19-Section3

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #19 January 26, 2015 Section Handout #3Recursion The purpose of this section is to give you some additional practice solving recursive problems. Problem 1. Weights and balances (Chapter 8, exercise 6, page 378) I am the only c

  • 3 Pages 16-RecursiveBacktracking
    16-RecursiveBacktracking

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #16 January 23, 2015 Recursive Backtracking Solving a Maze Recursive Backtracking Eric Roberts CS 106B January 23, 2015 The Right-Hand Rule A journey of a thousand miles begins with a single step. Lao Tzu, 6th century B.C.E.

  • 6 Pages 15A-Section2Solutions
    15A-Section2Solutions

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS106B Handout #15A January 21, 2015 Solutions to Section Handout #2 Problem 1. Using grids 2 Problem 2. Using queues 3 Problem 3. Using maps 4 5 6 Problem 4. Using lexicons

  • 3 Pages 19A-Section3Solutions
    19A-Section3Solutions

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #19A January 26, 2015 Solutions to Section Handout #3 Problem 1. Weights and balances 2 Problem 2. Shortest path Problem 3. Filling a region 3 Problem 4. Generating multiword anagrams

  • 4 Pages 20-SortingAndEfficiency
    20-SortingAndEfficiency

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #20 January 28, 2015 Sorting and Efficiency Sorting Sorting and Efficiency Of all the algorithmic problems that computer scientists have studied, the one with the broadest practical impact is certainly the sorting problem, wh

  • 4 Pages 23-Section4
    23-Section4

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #23 February 2, 2015 Section Handout #4 Pointers and Memory Problem 1. Differentiating the stack and the heap Using the heap-stack diagrams from Chapter 12 as a model, draw a diagram showing how memory is allocated just before

  • 3 Pages 23A-Section4Solutions
    23A-Section4Solutions

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #23A February 2, 2015 Solutions to Section Handout #4 Problem 1. Differentiating the stack and the heap 1a) Diagram using explicit addresses: 1b) Diagram using arrows: Problem 2: Pointer arithmetic 2a) a1[1] 2001 2b) a2[2] 3.

  • 3 Pages 22-DynamicAllocation
    22-DynamicAllocation

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #22 February 2, 2015 Dynamic Allocation The Allocation of Memory to Variables Dynamic Allocation When you declare a variable in a program, C+ allocates space for that variable from one of several memory regions. One region o

  • 4 Pages 24-ProblemSet1
    24-ProblemSet1

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #24 February 2, 2015 Problem Set #1 Due: Friday, February 6 by 5:00 P.M. Problem sets are pencil-and-paper exercises and may be submitted in section, in lecture, or to the box outside my office (Gates 202). Problem 1: Computat

  • 9 Pages 12-Assignment2
    12-Assignment2

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #12 January 16, 2015 Assignment #2Using ADTs The idea for Random Writer comes from Joe Zachary at the University of Utah. Parts of this handout were written by Julie Zelenski and Jerry Cain. Due: Monday, January 26 Now that yo

  • 3 Pages 13-RandomWriterContest
    13-RandomWriterContest

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #13 January 16, 2015 The CS106B Random Writer Contest Due date: Friday, January 30 On Assignment #2, the second problem has you create a random-writer application that uses a Markov model to generate English text according to

  • 4 Pages Practice Midterm #4 Solutions
    Practice Midterm #4 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #4 ANSWER KEY 1. C+ Basics / Parameters -6 1 5 12 -4 1 4 5 8 2 5 -4 9 2. File I/O and Strings (write) As with any programming problem, there are many correct solutions. Here is one: void inputStats(string filename) cfw_ ifstr

  • 7 Pages Practice Midterm #5 Solutions
    Practice Midterm #5 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #5 ANSWER KEY 1. C+ Basics / Parameters 4 0xdd00 7 12 6 0xff00 9 15 8 0xbb00 11 17 17 15 9 11 2. File I/O and Strings (write) As with any programming problem, there are many correct solutions. Here are two: / short-n-sweet so

  • 10 Pages Practice Midterm #4
    Practice Midterm #4

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #4 (based on CS 106B Autumn 2013 midterm) This sample exam is intended to demonstrate an example of some of the kinds of problems that will be asked on the actual midterm exam. We do not guarantee that the number of questions

  • 3 Pages Practice Midterm #6 Solutions
    Practice Midterm #6 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #6 ANSWER KEY 1. C+ Basics / Parameters (read) dx cx 21 2 cxx zx 301 22 zxx cxx 2 302 2 21 301 cxx zxx zx 2. File I/O and Strings (write) int printMostCommonName(ifstream& input) cfw_ int uniqueNames = 1; / counters for names

  • 10 Pages Practice Midterm #5
    Practice Midterm #5

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #5 (based on CS 106B Winter 2014 midterm) This sample exam is intended to demonstrate an example of some of the kinds of problems that will be asked on the actual midterm exam. We do not guarantee that the number of questions

  • 9 Pages Practice Midterm #6
    Practice Midterm #6

    School: Stanford

    Course: Programming Abstractions

    CS 106B Practice Midterm Exam #6 (based on CS 106B Summer 2014 midterm) This sample exam is intended to demonstrate an example of some of the kinds of problems that will be asked on the actual midterm exam. We do not guarantee that the number of questions

  • 2 Pages Section #1 Solutions
    Section #1 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS106B Section 1 Solutions (Week 2) 1. Passing Parameters. Original XehranM Cynthia Changed to cs(b, a); XehranM Marty Changed to a = cs(b, a); (Even though the second parameter gets changed by reference, it is then assigned the return value of the functi

  • 3 Pages 03-HonorCode
    03-HonorCode

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #3 January 5, 2015 Computer Science and the Stanford Honor Code Since 1921, academic conduct for students at Stanford has been governed by the Honor Code, which reads as follows: THE STANFORD UNIVERSITY HONOR CODE A. The Honor

  • 4 Pages 01-CoursePlacement
    01-CoursePlacement

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #1 January 5, 2015 Course Placement Information With extensive updates by Keith Schwarz and Mehran Sahami. CS 106A, CS 106B, CS 106L, CS 106X, CS 107, CS 101, CS 105, CS 107E, CS 142 there are a lot of programming classes to c

  • 6 Pages 02-CourseInformation
    02-CourseInformation

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #2 January 5, 2015 CS 106B General Information Professor: Eric Roberts E-mail: eroberts@cs.stanford.edu Offices: Gates 202 Phone: 723-3642 Drop-in hours: Tuesdays, 9:3011:30 A.M. Wednesdays after class in Bytes Caf TA: Kevin M

  • 5 Pages 05-Assignment1
    05-Assignment1

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #5 January 7, 2015 Assignment #1Simple C+ Parts of this handout were written by Julie Zelenski. Due: Friday, January 16 Part 1. Get Qt Creator working Your first task is to set up Qt Creator, which is the programming environme

  • 3 Pages 04-FunctionsInC++
    04-FunctionsInC++

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #4 January 7, 2015 Functions in C+ Administrative Essentials Functions in C+ All handouts and course information are on the web site: http:/cs106b.stanford.edu/ All CS 106B students must sign up for a section by Sunday at 5:

  • 2 Pages 09-Section1
    09-Section1

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS106B Handout #9 January 12, 2015 Section Handout #1Simple C+ Sections will meet once a week to give you a more intimate environment to discuss course material, work through problems, and raise any questions you have. Each week we will hand

  • 4 Pages 06-StringsAndStreams
    06-StringsAndStreams

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #6 January 9, 2015 Strings and Streams Administrative Reminders Strings and Streams All handouts and course information are on the web site: http:/cs106b.stanford.edu/ All CS 106B students must sign up for a section by Sunda

  • 2 Pages 07-SubmittingAssignments
    07-SubmittingAssignments

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #7 January 9, 2015 Submitting Assignments This handout was written by Jeremy Keeshin. This quarter, you will be submitting your assignments with Paperless, which is a tool that will let section leaders comment on your code wit

  • 2 Pages 09A-Section1Solutions
    09A-Section1Solutions

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS106B Handout #9A January 12, 2015 Solutions to Section Handout #1 Problem 1. String manipulation There are several possible strategies for implementing the character-removal problem. The implementations shown below go through the text strin

  • 4 Pages 21-MemoryAndC++
    21-MemoryAndC++

    School: Stanford

    Course: Programming Abstractions

    Eric Roberts CS 106B Handout #21 January 30, 2015 Memory and C+ Data Types in C+ Memory and C+ The data types that C+ inherits from C: Atomic types: short, int, long, and their unsigned variants float, double, and long double char bool Enumerated types

  • 6 Pages Midterm #2 Spring 2013 Solutions
    Midterm #2 Spring 2013 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS106B Spring 2013 Handout #25S June 3, 2013 CS106B Midterm Exam #2 Solutions Below is the score distribution for the first midterm exam: 100 90 80 70 60 50 40 30 20 10 17 118 0 16 117 0 15 116 0 14 115 0 13 114 0 12 113 0 11 112 0 10 111 0 010 0 0 Overal

  • 39 Pages karel-the-robot-learns-java
    Karel-the-robot-learns-java

    School: Stanford

    KAREL THE ROBOT LEARNS JAVA Eric Roberts Department of Computer Science Stanford University September 2005 Chapter 1 Introducing Karel the Robot In the 1970s, a Stanford graduate student named Rich Pattis decided that it would be easier to teach th

  • 2 Pages Section #2 Solutions
    Section #2 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS106B Section 2 Solutions (Week 3) 1. Stacks and Queues void reorder(Queue<int>& q) cfw_ Stack<int> s; int size = q.size(); / Separate positive and / negative numbers

  • 2 Pages Section #3 Solutions
    Section #3 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS106B Section 3 Solutions (Week 4) 1. 2. 3. Presection problem int digitSum(int n) cfw_ if (n < 0) cfw_ return -digitSum(-n); else if(n < 10) cfw_ return n;

  • 2 Pages Section #2
    Section #2

    School: Stanford

    Course: Programming Abstractions

    CS106B Section 2 Handout (Week 3) 1. 2. 3. 4. This week has more practice with data structures (Stacks, Queues, [Hash]Sets, [Hash]Maps), as well as a taste of writing functions recursively. As they say, in order to

  • 2 Pages Section #3
    Section #3

    School: Stanford

    Course: Programming Abstractions

    CS106B Section 3 Handout (Week 4) This week is all about practicing recursion, so all your code should be recursive, even if you can solve the problem iteratively. Try to make your recursion as elegant as possibl

  • 2 Pages Section #4
    Section #4

    School: Stanford

    Course: Programming Abstractions

    CS106B Section 4 Handout (Week 5) 1. 2. 3. 4. This week takes recursion a bit further with recursive backtracking. Remember Martys three steps to doing backtracking problems, where you need to explore multiple paths i

  • 2 Pages Section #4 Solutions
    Section #4 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS106B Section 4 Solutions (Week 5) 1. 2. Presection problem. Changes to lecture code (from slide 21 of 11-backtracking) are underlined. The sumAll method is unchanged, so it is not included here. (It just takes a

  • 4 Pages Section #5
    Section #5

    School: Stanford

    Course: Programming Abstractions

    CS 106B Section 5 Handout (Week 6) ListNode structure (represents a single data value in a linked list, and a link to the next node) struct ListNode cfw_ int data; / data stored in this node

  • 4 Pages Section #6
    Section #6

    School: Stanford

    Course: Programming Abstractions

    CS 106B Section 6 Handout (Week 8) This week is all binary trees. Remember that the recursive structure of trees makes writing recursive methods for them very natural. Recommended problems: 3, 8, 12, 13. (Try to do a

  • 2 Pages Section #8
    Section #8

    School: Stanford

    Course: Programming Abstractions

    CS 106B Section 8 Handout (Week 10) The last section! This week has a little bit of new content, and then some problems to review some of the bigger concepts from the second half of the quarter. Recommended problems

  • 4 Pages Section #5 Solutions
    Section #5 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS106B Section 5 Solutions (Week 6) Presection problems 1. 2. v1 : 70 v2 : 25 p1 : points to v1 p2 : points to v1 list->next->next->next->next = list->next->next; / 40->30 l

  • 4 Pages Section #6 Solutions
    Section #6 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS 106B Section 6 Solutions (Week 8) Presection problem. Dwalin / \ Balin Kili \ / \ Dori Fili Nori /

  • 4 Pages Section #7 Solutions
    Section #7 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS 106B Section 7 Solutions (Week 9) Presection problem. V: cfw_CS1, CS2, CS3, CS4, CS5, CS6, CS7, CS8 E: cfw_CS1-CS2, CS2-CS3, CS2-CS4, CS2-CS5, CS3-CS7, CS3-CS8, CS4-CS6, CS5-CS6, CS5-CS7, CS5-CS8 Adjacency List: C

  • 3 Pages Section #8 Solutions
    Section #8 Solutions

    School: Stanford

    Course: Programming Abstractions

    CS 106B Section 8 Solutions (Week 10) 1. hash1 is valid, but not good because everything will get hashed to the same bucket. hash2 is not valid, because A and a are equal, but will have different hash values

  • 12 Pages 01-intro-to-cpp
    01-intro-to-cpp

    School: Stanford

    Course: Programming Abstractions

    CS 106B, Lecture 1 Introduction to C+ reading: Programming Abstractions in C+, Chapter 1, 2.1 - 2.2 This document is copyright (C) Stanford Computer Science and Marty Stepp, licensed under Creative Commons Attribution 2.5 License. All rights reserved. Bas

  • 36 Pages 02-functions-strings
    02-functions-strings

    School: Stanford

    Course: Programming Abstractions

    CS 106B, Lecture 2 C+ Functions; Strings reading: Programming Abstractions in C+, Chapters 2-3 This document is copyright (C) Stanford Computer Science and Marty Stepp, licensed under Creative Commons Attribution 2.5 License. All rights reserved. Based on

  • 4 Pages Section #7
    Section #7

    School: Stanford

    Course: Programming Abstractions

    CS 106B Section 7 Handout (Week 9) This week is about graphs with vertices and edges. The first couple pages are cheat sheets for graph terminology and common search algorithms. Recommended problems: do 1-4 to get com

  • 2 Pages Section #1
    Section #1

    School: Stanford

    Course: Programming Abstractions

    CS106B Section 1 Handout (Week 2) Welcome to CS106B section! Work with your classmates and section leader on these problems. Feel free to jump around to different topics based on what you want to discuss. There i

  • 8 Pages Homework #7
    Homework #7

    School: Stanford

    Course: Programming Abstractions

    Stanford University, CS 106B Homework Assignment 7: Trailblazer Thanks to Keith Schwarz, Dawson Zhou, Eric Roberts, Julie Zelenski, Nick Parlante, Jerry Cain, and Leonid Shamis (UC Davis) for creating and evolving this assignment and its predecessor, "Pat

  • 1 Page find range code
    Find Range Code

    School: Stanford

    Course: CS106

    /* * File: FindRange.java * -* This program is a stub for the FindRange problem, which finds the * smallest and largest values in a list of integers. */ import acm.program.*; public class FindRange extends ConsoleProgram cfw_ public void run() cfw_ / This

  • 3 Pages 06-C++-Strings
    06-C++-Strings

    School: Stanford

    Course: Programming

    CS106X Handout 06 January 5th, 2011 Winter 2011 C+ Strings Original handout written by Neal Kanodia, with help from Steve Jacobson. C+ Strings One of the most useful data types supplied in the C+ libraries is the string. A string is a variable that stores

  • 8 Pages 09-karel-examples
    09-karel-examples

    School: Stanford

    Course: PROGRAMMING METHODOLOGY

    Mehran Sahami CS 106A Handout #9 September 26, 2014 Example Karel Problems Portions of this handout by Eric Roberts Running a steeple chase In class, we examined a SteepleChase program that allows Karel to run a "Steeple Chase" (like a hurdles race, but w

  • 5 Pages 1_IntroKarel
    1_IntroKarel

    School: Stanford

    Course: PROGRAMMING METHODOLOGY

    for loop for (int i = 0; i < count; i+) cfw_ private void turnRight() cfw_ for (int i = 0; i < 3; i+) cfw_ turnLeft(); while loop while ( condition ) cfw_ private void moveToWall() cfw_ while (frontIsClear() cfw_ move(); Conditions Karel can check f

  • 3 Pages 2_IntroJava
    2_IntroJava

    School: Stanford

    Course: PROGRAMMING METHODOLOGY

    The Java Interpreter source file class file import acm.program.*; public class Hello public void run() cfw_ println("hello"); CA 00 00 01 FE 16 04 00 BA 07 00 16 BE 00 07 2B 00 1A 0C 4C 03 07 00 6A JAR archive 00 00 13 61 compiler linker CA 00 00 01 47

  • 8 Pages 060 Assignment 1
    060 Assignment 1

    School: Stanford

    Course: PROGRAMMING METHODOLOGY

    CS106A Winter 2012-2013 Handout #06 January 9, 2013 Assignment 1: Email and Karel the Robot _ Based on a handout by Eric Roberts and Mehran Sahami In this first assignment, you'll see just how powerful Karel the Robot can be as you use him to solve a vari

  • 9 Pages 200 Assignment 4
    200 Assignment 4

    School: Stanford

    Course: PROGRAMMING METHODOLOGY

    CS106A Winter 2012-2013 Handout #20 February 8, 2013 Assignment 4: Hangman _ Based on a handout by Eric Roberts and Mehran Sahami Due Wednesday, February 20 at 3:15PM For this assignment, your mission is to write a program that plays the game of Hangman.

Back to course listings