Introduction to CS 106B Eric Roberts CS 106B January 7, 2013

Slides:



Advertisements
Similar presentations
Chapter 6 Writing a Program
Advertisements

Credit hours: 4 Contact hours: 50 (30 Theory, 20 Lab) Prerequisite: TB143 Introduction to Personal Computers.
Lecture 22, Revision 1 Lecture notes Java code – CodeFromLectures folder* Example class sheets – 4 of these plus solutions Extra examples (quicksort) Lab.
Chapter 11: Models of Computation
CSS446 Spring 2014 Nan Wang. 2 Instructor Instructors: –Nan Wang Office: TEC 232 Phone: (601) Meeting time and location:
ITEC200 Week04 Lists and the Collection Interface.
Operating Systems Operating Systems - Winter 2012 Dr. Melanie Rieback Design and Implementation.
1 Multimedia Systems 2 Dr Paul Newbury School of Engineering and Information Technology ENGG II - 3A11 Ext:
CMPT 275 Software Engineering
Copyright 2013 – Noah Mendelsohn Compiling C Programs Noah Mendelsohn Tufts University Web:
CINAHL Keyword Searching. This presentation will take you through the procedure of finding reliable information which can be used in your academic work.
J Paul Gibson, NUI Maynooth 2004/2005: CS211Intro. 1 CS211 Algorithms & Data Structures, with GUI Programming
Analysis & Design of Algorithms (CSCE 321)
Cpt S 122 – Data Structures Course Introduction
CMPT 225 Data Structures and Programming. Course information Lecturer: Jan Manuch (Jano), TASC TAs: Osama Saleh,
1-1 CMPT 225 Data Structures and Programming Instructor: Aaron Hunter Section: E300 Campus: Harbour Centre Semester: Spring 2007.
Jan Welcome to the Course of Advanced Algorithm Design (ACS-7101/3)
1 CENG 707 Data Structures and Algorithms Nihan Kesim Çiçekli Department of Computer Engineering Middle East Technical University Fall 2010.
June 13, Introduction to CS II Data Structures Hongwei Xi Comp. Sci. Dept. Boston University.
CMSC 132: Object-Oriented Programming II
CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.
Course Overview CS221 – Advanced Programming Fall 2007 : Ray S. Babcock Computer Science Department Montana State University.
Administrivia- Introduction CSE 373 Data Structures.
COMP171 Data Structures and Algorithm Huamin Qu Lecture 1 (Sept. 1, 2005)
CSC 171 – FALL 2004 COMPUTER PROGRAMMING LECTURE 0 ADMINISTRATION.
COMP171 Data Structures and Algorithm Qiang Yang Lecture 1 ( Fall 2006)
EE 220 (Data Structures and Analysis of Algorithms) Instructor: Saswati Sarkar T.A. Prasanna Chaporkar, Programming.
COMP152 Object-Oriented Programming and Data Structures Spring 2011.
7/3/2015Data Structures and Algorithms1 Dick Steflik Fall 2012.
CSCE 3110 Data Structures and Algorithm Analysis.
Data Structures and Programming.  John Edgar2.
Computer Science 102 Data Structures and Algorithms V Fall 2009 Lecture 1: administrative details Professor: Evan Korth New York University 1.
COMP 151: Computer Programming II Spring Course Topics Review of Java and basics of software engineering (3 classes. Chapters 1 and 2) Recursion.
© 2004 Goodrich, Tamassia CS2210 Data Structures and Algorithms Lecture 1: Course Overview Instructor: Olga Veksler.
Teaching Teaching Discrete Mathematics and Algorithms & Data Structures Online G.MirkowskaPJIIT.
Course Introduction Bryce Boe 2012/08/06 CS32, Summer 2012 B.
Data Structures and Programming.  Today:  Administrivia  Introduction to 225, Stacks  Course website: 
EECE 310 Software Engineering Lecture 0: Course Orientation.
CSC 212 – Data Structures Prof. Matthew Hertz WTC 207D /
COMPE 226 Data Structures 2015 Fall Murat KARAKAYA Department of Computer Engineering.
CIS 068 Welcome to CIS 068 ! Software Design & Data Structures In JAVA Instructor: Rolf Lakaemper Peer Teacher: Aubrey Jones TA: Michael Broscius.
Welcome to CIS 2168 ! Software Design, Data Structures and Algorithms
Welcome to CS 115! Introduction to Programming. Class URL Write this down!
Data Structures (Second Part) Lecture 1 Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University.
Introduction to Data Structures
Computer Science 102 Data Structures and Algorithms CSCI-UA.0102 Fall 2012 Lecture 1: administrative details Professor: Evan Korth New York University.
Welcome to CIS 2168 ! Data Structures and Algorithms
ICS202 Data Structures King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science Department.
CIS 068 Welcome to CIS 068 ! Software Design & Data Structures In JAVA Instructor: Rolf Lakaemper.
Course Review Fundamental Structures of Computer Science Margaret Reid-Miller 29 April 2004.
Introduction to CS 106A Eric Roberts CS 106A January 4, 2016.
Data Structures and Algorithms in Java AlaaEddin 2012.
Principles of Imperative Computation Lecture 1 January 15 th, 2012.
CS140 – Computer Programming 1 Course Overview First Semester – Fall /1438 – 2016/2017 CS140 - Computer Programming 11.
CSCE 210 Data Structures and Algorithms
Introduction to CS 106B Eric Roberts CS 106B January 5, 2015.
CSC 427: Data Structures and Algorithm Analysis
Computer Engineering Department Islamic University of Gaza
Eric Roberts and Jerry Cain
CSc 020: Programming Concepts and Methodology II
Midterm Review.
Computer Science 102 Data Structures CSCI-UA
Programming COMP104: Fundamentals and Methodology Introduction.
slides courtesy of Eric Roberts
CS 1302 Programming Principles II
EECE 310 Software Engineering
Review CSE116 2/21/2019 B.Ramamurthy.
Course Overview CS221 – Advanced Programming
Principles of Imperative Computation
Computer Engineering Department Islamic University of Gaza
Presentation transcript:

Introduction to CS 106B Eric Roberts CS 106B January 7, 2013 http://cs106b.stanford.edu Eric Roberts CS 106B January 7, 2013

CS 106B Staff Professor: Eric Roberts Office Hours (Gates 202): eroberts@cs.stanford.edu Office Hours (Gates 202): Tuesdays 9:30-11:30 Head TA: Dawson Zhou zhoud@cs.stanford.edu Office Hours (Gates 160): Tuesdays 1:30-3:30 Thursdays 1:30-3:30

Essential Information CS 106B: Programming Abstractions (ENGR 70B) Abstraction and its relation to programming. Software engineering principles of data abstraction and modularity. Object-oriented programming, fundamental data structures (such as stacks, queues, sets) and data-directed design. Recursion and recursive data structures (linked lists, trees, graphs). Introduction to time and space complexity analysis. Uses the programming language C++ covering its basic facilities. Prerequisite: 106A or equivalent. Terms: Aut, Win, Spr, Sum | Units: 3-5 | UG Reqs: GER:DBEngrAppSci | Grading: Letter or Credit/No Credit Instructors: Cain, G. (PI); Roberts, E. (PI), Schwarz, K. (PI) Schedule for CS 106B 2012-2013 Winter CS 106B | 3-5 units | UG Reqs: GER:DBEngrAppSci | Class # 5722 | Section 01 | Grading: Letter or Credit/No Credit | LEC 01/07/2013 - 03/15/2013 Mon, Wed, Fri 3:15 PM - 4:05 PM at Hewlett Teaching Center 200 with Roberts, E. (PI) Instructors: Roberts, E. (PI) Notes: Same as Eng 70B. May be taken for 3 units by graduate students.

Is CS 106B the Right Course? CS 106A: Programming Methodology Introduction to the engineering of computer applications emphasizing modern software engineering principles: object-oriented design, decomposition, encapsulation, abstraction, and testing. Uses the Java programming language. Emphasis is on good programming style and the built-in facilities of the Java language. No prior programming experience required. Terms: Aut, Win, Spr, Sum | Units: 3-5 | UG Reqs: GER:DBEngrAppSci | Grading: Letter or Credit/No Credit Instructors: Cooper, S. (PI) ; Sahami, M. (PI) ; Schwarz, K. (PI) CS 106X: Programming Abstractions (Accelerated) Intensive version of 106B for students with a strong programming background interested in a rigorous treatment of the topics at an accelerated pace. Additional advanced material and more challenging projects. Prerequisite: excellence in 106A or equivalent, or consent of instructor. Terms: Aut | Units: 3-5 | UG Reqs: GER:DBEngrAppSci | Grading: Letter or Credit/No Credit Instructors: Cain, G. (PI)

The Demand for Computer Science Phil Levis, http://csl.stanford.edu/~pal/ed/ Doctorate 161,857 Master’s Bachelor’s Job openings 129,045 94,889 57,127 49,200 55,208 31,357 10,075 Physical Sciences Biological Sciences Engineering Computer Science We are very happy with the students that we get from this university. . . . We just wish we could hire two to three times as many of them. Bill Gates at Stanford, February 19, 2008 — The educational data comes from the National Center for Education Statistics IPEDS (Integrated Postsecondary Education Data System) Data Center. The data used is for degrees granted in the 2008-2009 academic year. The employment data comes from the Department of Labor’s Occupational Outlook Handbook for 2010-11. This handbook includes employment for 2008 as well as a 10-year projection to 2018. I manually selected which occupations mapped to which degrees. I calculated job openings per year as 10% of the expected job growth over 2008-2018 plus 2.5% of the number of jobs in 2008. This second term describes the number of jobs opening as people retire. It assumes that people work for 40 years and leave a job at a uniform rate; the latter is of course not true in difficult economic times.

The Big Ideas in CS 106B Recursion. Recursion is an enormously powerful technique that enables you to solve complex problems that you would never be able to solve without it. Data abstraction. For most of the quarter, we’ll be learning about a variety of abstract data types that will prove to be enormously valuable as you write programs. Algorithmic efficiency. As you will learn over the course of the quarter, different algorithms can vary enormously in terms of the amount of time required to solve a particular problem. In CS 106B, you will learn how to measure algorithmic efficiency along with some general techniques for developing efficient algorithms.

The Power of Recursion

Libraries and interfaces Syllabus—Week 1 January 7 Course overview The big ideas in CS 106B The C++ language C++ vs. Java 9 Functions in C++ Call by reference Libraries and interfaces Recursive functions Read: Chapters 2 and 7 11 Using the string class File streams Class hierarchies Read: Chapters 3 and 4 Read: Chapter 1

The TokenScanner class Syllabus—Week 2 14 Abstract data types Using Vector and Grid Stacks and queues Read: Sections 5.1-5.3 18 Map, Set, and Lexicon The foreach macro Read: Sections 5.4-5.6 20 Designing classes The TokenScanner class Read: Chapter 6 Due: HW #1 (Simple C++)

Recursive backtracking Syllabus—Week 3 21 Martin Luther King Day Optional film: Dr. King’s 1963 speech “I Have a Dream” 23 Procedural recursion The Towers of Hanoi Graphical recursion Read: Chapter 8 25 Recursive backtracking Solving a maze Read: Chapter 9

Syllabus—Week 4 Backtracking and games The minimax algorithm 28 Backtracking and games The minimax algorithm Read: Sections 9.2-9.3 Due: HW #2 (Using ADTs) 30 Algorithmic efficiency Big-O notation Sorting algorithms Read: Chapter 10 February 1 The C++ memory model Pointers Read: Chapter 11 Due: RandomWriter contest

Syllabus—Week 5 Dynamic allocation The editor.h interface 4 Dynamic allocation Read: Chapter 12.1-12.8 Due: HW #3 (Recursion) 6 The editor.h interface Read: Sections 13.1-13.3 8 Implementing editors Read: Sections 13.4-13.5 Midterm Exam Tuesday, February 5 3:15 or 7:00 P.M.

Syllabus—Week 6 Templates Implementing stacks Implementing queues 11 Templates Implementing stacks Read: Section 14.1-14.2 13 Implementing queues Implementing vectors Read: Sections 14.3-14.4 15 The StringMap class The idea of hashing Implementing HashMap Read: Chapter 15

Syllabus—Week 7 President’s Day (no class) Binary search trees 18 President’s Day (no class) 20 Binary search trees Balanced trees Implementing Map Read: Sections 16.1-16.4 Due: HW #4 (Boggle) 22 Sets in mathematics Implementing sets Read: Sections 17.1-17.3

Syllabus—Week 8 Graphs Standard traversals Overview of Pathfinder 25 Graphs Standard traversals Read: Sections 18.1-18.4 Due: Recursion contest 27 Overview of Pathfinder Shortest-path algorithms Minimum spanning trees Read: Sections 18.5-18.6 March 1 Inheritance in C++ Defining shape classes Read: Sections 19.1-19.2

Representing expressions Syllabus—Week 9 4 Expression trees Representing expressions Read: Section 19.3 6 Parsing strategies Overview of BASIC Read: Section 19.4 Due: HW #5 (Pathfinder) 8 C++ in the real world Using the STL The mysteries of const

Week #10 Advanced algorithms Google’s Page Rank DAWGs and lexicons 11 Advanced algorithms Google’s Page Rank DAWGs and lexicons Heaps and priority queues 9 7 Further adventures in CS (optional) Strategies for iteration Function pointers Function objects The <algorithm> library Read: Sections 16.5, 18.7 Read: Chapter 20 Due: HW #6 (BASIC) Due: BASIC contest Final Exam times: Tuesday, March 19 Thursday, March 21 12:15-3:15 P.M.

Assignments in CS 106B Assignments in CS 106B are due at 5:00P.M. Assignments that come in after 5:00 will be considered late. Everyone in CS 106B starts the quarter with two “late days” that you can use whenever you need some extra time. In my courses, late days correspond to class meetings, so that, if an assignment is due on Wednesday and you turn it in on Friday, that counts as one late day. Extensions must be approved by the TA (Dawson Zhou). Assignments are graded by your section leader, who discusses your work in an interactive, one-on-one grading session. Each assignment is given two grades: one on functionality and one on programming style. Style matters. Companies in Silicon Valley expect Stanford graduates to understand how to write code that other programmers can maintain.

The CS 106B Grading Scale Functionality and style grades for the assignments use the following scale: A submission so good it “makes you weep.” Exceeds requirements. Satisfies all requirements of the assignment. Meets most requirements, but with some problems. Has more serious problems. Is even worse than that. Why did you turn this in?

Contests CS 106B will have three contests as follows: The Random Writer Contest associated with Assignment #2 The Recursion Contest associated with Assignments #3 and #4 The BASIC Contest associated with Assignment #6 First prize in the contest is a score of 100% on one of the graded components of the course, typically the final exam. As an additional incentive, entering any of the contests gives you chances to win an additional grand prize in a random drawing at the end of the quarter. Securing a runner-up prize or an honorable mention on any contest gives you additional chances in the random drawing, as does having an assignment submitted as a + + candidate.

Honor Code Rules Rule 1: You must indicate on your submission any assistance you received. Rule 2: You must not share actual program code with other students. Rule 3: You must not look at solutions posted on the web or from other years. Rule 4: You must be prepared to explain any program code you submit.

The “Hello World” Program One of the important influences on the design of Java was the C programming language, which was developed at Bell Labs in the early 1970s. The primary reference manual for C was written by Brian Kernighan and Dennis Ritchie. 1.1 Getting Started The only way to learn a new programming language is to write programs in it. The first program to write is the same for all languages: Print the words hello, world This is the big hurdle; to leap over it you have to be able to create the program text somewhere, compile it, load it, run it, and find out where your output went. With these mechanical details mastered, everything else is comparatively easy. In C, the program to print “hello, world” is #include <stdio.h> main() { printf("hello, world"); } On the first page of their book, the authors suggest that the first step in learning any language is to write a simple program that prints the message “hello, world” on the display. That advice remains sound today.

The “Hello World” Program /* * File: HelloWorld.cpp * -------------------- * This file is adapted from the example * on page 1 of Kernighan and Ritchie's * book The C Programming Language. */ #include <iostream> using namespace std; int main() { cout << "hello, world" << endl; return 0; } Download: HelloWorld.cpp

Evolution of Computer Languages

Size and Complexity in Languages

Essential and Accidental Complexity To see what rate of progress one can expect in software technology, let us examine the difficulties of that technology. Following Aristotle, I divide them into essence, the difficulties inherent in the nature of software, and accidents, those difficulties that today attend its production but are not inherent. . . . The complexity of software is an essential property not an accidental one. Hence, descriptions of a software entity that abstract away its complexity often abstract away its essence. — Fred Brooks “No Silver Bullet” IEEE Computer, April 1987

C++ vs. Java: Accidental Differences The type of Boolean variables is bool instead of boolean. The type char represents an 8-bit ASCII character instead of a 16-bit Unicode character. Programs in C++ begin by calling a function named main that returns an integer status, which is 0 on successful completion. All functions used in a C++ program must be preceded by a prototype that defines their parameter structure. There are many accidental differences in the methods exported by the string class. For example, the second argument to the C++ substr method is the length and not the ending position. The discipline used for console I/O is significantly different, but not essentially so.

C++ vs. Java: Essential Differences C++ allows you to get very close to the inner workings of the machine. Java protects you from these details. C++ supports call by reference. C++ allows programmers to modify the language in more ways than Java does. In particular, a C++ class can redefine the meaning of operators such as + or <<. C++ has no garbage collector of the sort that Java does. As a result, you are responsible for freeing any memory that is allocated on the heap. Objects in Java are always allocated in the heap. In C++, objects are typically stored on the stack to simplify the task of memory management. C++ supports multiple inheritance, which means that classes can inherit behavior from more than one superclass.

The End