CPSC 121: Models of Computation Unit 0 Introduction Based on - - PowerPoint PPT Presentation

cpsc 121 models of computation
SMART_READER_LITE
LIVE PREVIEW

CPSC 121: Models of Computation Unit 0 Introduction Based on - - PowerPoint PPT Presentation

CPSC 121: Models of Computation Unit 0 Introduction Based on slides by Patrice Belleville and Steve Wolfman Introductions Sections 101 and 102 : Instructor: George Tsiknis Office: ICCS 307 Email: tsiknis@cs.ubc.ca Office Hours: TBA on


slide-1
SLIDE 1

CPSC 121: Models of Computation Unit 0 Introduction

Based on slides by Patrice Belleville and Steve Wolfman

slide-2
SLIDE 2

Introductions

 Sections 101 and 102:

Instructor: George Tsiknis Office: ICCS 307 Email: tsiknis@cs.ubc.ca Office Hours: TBA on course web site

 Sections 103:

Instructor: Ryan Vogt Office: ICCS 247 Email: vogtr@cs.ubc.ca Office Hours: TBA on course web site

 Course Coordinator:

Trey Scheifelbein Email: cpsc121-admin@cs.ubc.ca)

 TAs : See course site.

Unit 0 - Introduction 2

slide-3
SLIDE 3

Today's Learning Goals

 By the end of this unit, you should be able to:

  • Give an example of how we can apply formal

reasoning to a simple, real-world task.

  • Give an example of how a computational solution to

this simple task might go wrong.

  • Describe the four “big questions” which we will

address in CPSC 121.

Unit 0 - Introduction 3

slide-4
SLIDE 4

Activity

 Find an algorithm to order students by birthday.

Unit 0 - Introduction 4

Jan 1st Feb 24th Jul 24th Jul 31st Sept 18th

slide-5
SLIDE 5

Problem

 How many swaps did you need to make?

Unit 0 - Introduction 5

slide-6
SLIDE 6

Question

What is the maximum number of swaps we may make to order 4 people by their birthday?

  • a. 3
  • b. 4
  • c. 6
  • d. 12
  • e. None of these

Unit 0 - Introduction 6

slide-7
SLIDE 7

How many swaps?

 For 1 person?  For 2 people?  For 3 people?  For 4 people?  For 5 people?  …  For n people?

Unit 0 - Introduction 7

slide-8
SLIDE 8

Computing Swaps with DrRacket

 Computing n(n-1)/2 using DrRacket:

Unit 0 - Introduction 8

slide-9
SLIDE 9

Computing Swaps in Java

 Computing n(n-1)/2 using Java:

Unit 0 - Introduction 9

import java.io.*; public class Compute { public static void main(String[] args) { int n = Integer.parseInt(args[0]); System.out.println(n * (n-1) / 2); } } poirot> java Compute 5 10 poirot> java Compute 1000 499500 poirot> java Compute 1000000

  • 364189984
slide-10
SLIDE 10

Questions About this Exercise:

 How can we prove that n(n-1)/2 is the largest number

  • f swaps needed for n birthdays?
  • Can use the method of Mathematical Induction

 Why did our Java implementation print a negative

value, but not the Racket implementation?

  • Use different Number Representation

Unit 0 - Introduction 10

slide-11
SLIDE 11

CPSC 121: The BIG questions:

  • 1. How can we convince ourselves that an algorithm

does what it's supposed to do?

  • 2. How do we determine whether or not one algorithm

is better than another one?

  • 3. How does the computer (e.g. Dr. Racket) decide if

the characters of your program represent a name, a number, or something else? How does it figure

  • ut if you have mismatched " " or ( )?
  • 4. How can we build a computer that is able to

execute a user-defined program?

Unit 0 - Introduction 11

? ?

slide-12
SLIDE 12

Our Working Computer

 A working computer you will learn about in the labs:

Unit 0 - Introduction 12

slide-13
SLIDE 13

Course Learning Outcomes

 After you complete the course, you will be able to:

  • model important problems so that it is easier to discuss,

reason about, solve, and test them.

  • learn new modeling formalisms more easily.
  • communicate clearly and unambiguously with other CS

experts on complex topics.

  • characterize algorithms (CS problem solutions), by proving

their correctness or efficiency.

  • critically read proofs: justifying why each step is correct and

judging what the proof means.

  • explain how computers work.

Unit 0 - Introduction 13

slide-14
SLIDE 14

Course Sites

 Explore the CPSC 121 website:

http://www.ugrad.cs.ubc.ca/~cs121/2017W1/

  • You are required to be familiar with the course website.

 Read carefully the Course Info section on the course

web site.

 Check the Connect site for the course for Pre-class

Quizzes & Marks:

  • http://www.connect.ubc.ca

 Check the Piazza site for the course discussion board:

  • https://piazza.com/ubc.ca/winterterm12017/cpsc121

to signup

  • https://piazza.com/ubc.ca/winterterm12017/cpsc121/home

after that. Check announcements very often

Unit 0 - Introduction 14

slide-15
SLIDE 15

Course Activities

 Here are the parts of this course.

  • Lecture (required): cover theoretical material
  • Clicker questions: check understanding of lecture concepts
  • Labs (required): work hands-on with model computer
  • Online quizzes (required): test understanding of readings
  • Tutorials (optional): highly recommended practice problems
  • Midterms (2)
  • Final Exam

Unit 0 - Introduction 15

slide-16
SLIDE 16

Grading

 Your final grade will be computed as following:

  • Assignments (5)

14%

  • Labs (9)

14%

  • Pre-class Quizzes (~10)

5%

  • In class participation

(Clicker Questions) 3%

  • Midterm #1

12%

  • Midterm #2

12%

  • Final Exam

40%

 To pass the course, you must obtain at least 50% on the

final exam, and at least 50% on your combined lab and assignment marks.

Unit 0 - Introduction 16

slide-17
SLIDE 17

Labs and Tutorials

 Labs

  • Start on Monday September 11th.
  • Usually have a pre-lab and in-lab work
  • Pre-lab work must be done before you get to the lab.
  • In-lab work must be completed during the lab time, so the TAs will be

able to mark it.

  • You must attend the lab you are registered for.

 Tutorials

  • Start on Monday September 11th.
  • You will work in small groups on problems suggested by the TA.
  • Try to attend the tutorial you are registered for.

Unit 0 - Introduction 17

slide-18
SLIDE 18

Assignments, Quizzes and Exams

 Assignments

  • Problems that exercise the material discussed in the lectures.
  • We encourage you to do them in groups of two.

 Pre-Class Reading and Quizzes

  • To facilitate your learning we assign reading from the text

followed by a related quiz before certain lectures.

  • Usually one quiz every week, due at 7:00pm before the

lecture day.

  • Each quiz has two parts: part A and part B. MAKE SURE YOU

DO BOTH.

 There will be 2 midterms:

  • Friday October 13th, 2017, from 17:00 to 18:00, and
  • Wednesday November 15th, 2017, from 18:00 to 19:00.

 The final exam will be scheduled by UBC in December.

Unit 0 - Introduction 18

slide-19
SLIDE 19

Lab and Assignment Schedule

19 Unit 0 - Introduction

Sunday Monday Tuesday Wednesday Thurday Friday Sept 3rd First class Sept 10th Lab 1 Lab 1 Lab 1 Lab 1 Lab 1 Sept 17th Lab 2 Lab 2 Lab 2 Lab 2 Lab 2 Sept 24th Lab 3 Assign 1 due Lab 3 Lab 3 Lab 3 Lab 3 Oct 1st Lab 4 Lab 4 Lab 4 Lab 4 Lab 4 Oct 8th Holiday Assign 2 due Midterm 1

slide-20
SLIDE 20

Lab and Assignment Schedule (cont')

20 Unit 0 - Introduction

Sunday Monday Tuesday Wednesday Thurday Friday Oct 15th Lab 5 Lab 5 Lab 5 Lab 5 Lab 5 Oct 22nd Lab 6 Lab 6 Lab 6 Lab 6 Lab 6 Assing 3 due Oct 29th Lab 7 Lab 7 Lab 7 Lab 7 Lab 7 Nov 5th Lab 8 Lab 8 Lab 8 Lab 8 Lab 8 Assign 4 due Nov 12th Holiday

Midterm 2

Nov 19th Lab 9 Lab 9 Lab 9 Lab 9 Lab 9 Nov 26th Assgn 5 due

slide-21
SLIDE 21

Tips for Success (University and 121)

 Success in lecture?

  • Taking notes, beyond just printing slides
  • I recommend pen / pencil for CPSC 121

 Success overall?

  • Get a copy of (one of) the textbooks right away
  • Staple your assignments before turning them in

 Who do I contact?

  • Lecture questions: Piazza, instructor office hours, TA office

hours (“Demco” or “DLC” hours)

  • Lab questions: your lab TA
  • HR matters (registration, etc.): course coordinator
  • Regrade requests: course coordinator
  • Private matters: instructor via email

Unit 0 - Introduction 21

slide-22
SLIDE 22

First Quiz

 The first online quiz is due: Sunday, Sept 10, at

7:00pm.

  • You should complete Quiz 1 before you start Lab 1

 Sections to read for the quiz:

  • Epp, 4th edition: 2.1 and 2.4.
  • Epp, 3rd edition: 1.1 and 1.4
  • Rosen, 7th edition: 1.1 up to the top of page 6, and 12.3.
  • Rosen, 6th edition: 1.1 up to the top of page 6, and 11.3.

Unit 0 - Introduction 22

slide-23
SLIDE 23

Second Quiz

 Second online quiz is due on

Wednesday, Sept 13, 7:00pm.

 Assigned reading for the quiz:

  • Epp, 4th edition: 2.2
  • Epp, 3rd edition: 1.2
  • Rosen, 6th or 7th edition: 1.1 from page 6 onwards.

Unit 0 - Introduction 23