CSCI211: Intro Objectives

Similar documents
Analyzing proofs Introduction to problem solving. Wiki: Everyone log in okay? Decide on either using a blog or wiki-style journal?

Proving correctness of Stable Matching algorithm Analyzing algorithms Asymptotic running times

Lab 11: Pair Programming. Review: Pair Programming Roles

Objec&ves. Usability Project Discussion. May 9, 2016 Sprenkle - CSCI335 1

Text UI. Data Store Ø Example of a backend to a real Could add a different user interface. Good judgment comes from experience

CS 4407 Algorithms Greedy Algorithms and Minimum Spanning Trees

Tuesday November 29, 2016

Minimum Spanning Tree Union-Find Data Structure. Feb 28, 2018 CSCI211 - Sprenkle. Comcast wants to lay cable in a neighborhood. Neighborhood Layout

Spring 2017 Grad Course Atlas

Thursday, May 4, :00 AM AP Government Exam

NEW YORK CITY COLLEGE OF TECHNOLOGY The City University of New York

POLS 110 Introduction to Political Science

Strategic Models of Politics

CHE 572: Modelling Process Dynamics

FINAL EXAM: Political Economy Winter 2017

MATH 1340 Mathematics & Politics

MAC 2311 CALCULUS 1 FALL SEMESTER 2015

RPOS 334 American Political Parties and Groups. Location: SS 256

INTA 1200 FALL 2018 MWF 1:55-2:45 DM Smith 105. American Government

Objec&ves. Review. So-ware Quality Metrics Sta&c Analysis Tools Refactoring for Extensibility

THE PREPARED CURRICULUM:

AP United States Government and Politics Syllabus

Professor Halva-Neubauer 111G Johns Hall

Approval Voting Theory with Multiple Levels of Approval

The College of Charleston Fall POLI American Government MWF 12:00-12:50 P.M. Maybank Hall 307

Department of Political Science Public Opinion

The Biology of Politics Fall 2016 Monday & Wednesdays, 11:00am - 12:15pm

Hoboken Public Schools. Principals of Acting-Theatre Two Curriculum

THE PREPARED CURRICULUM:

Bellwood-Antis School District Curriculum Revised on 8/23/2011

Comparison Sorts. EECS 2011 Prof. J. Elder - 1 -

PEORIA COUNTY JAIL DAILY COMMITMENT REPORT PDF

SNORTH VISTA SECONDARY SCHOOL HUMANITIES DEPARTMENT SECONDARY 1 NORMAL ACADEMIC GEOGRAPHY CONTENT OUTLINE 2018

Fall Articles, book chapters, and primary sources (posted under pages on Canvas)

POL 10a: Introduction to Political Theory Spring 2017 Room: Golding 101 T, Th 2:00 3:20 PM

Changing Embassy Supreme Court Ruling

Constraint satisfaction problems. Lirong Xia

SEMESTER AT SEA COURSE SYLLABUS University of Virginia, Academic Sponsor

Introduction to Game Theory. Lirong Xia

Applied Multidimensional Scaling

Cloning in Elections 1

Chapter 11. Weighted Voting Systems. For All Practical Purposes: Effective Teaching

THE PREPARED CURRICULUM: FOR POST-SECONDARY AND CAREEER READINESS

1. The augmented matrix for this system is " " " # (remember, I can't draw the V Ç V ß #V V Ä V ß $V V Ä V

Grade 8. NC Civic Education Consortium 1 Visit our Database of K-12 Resources at

PSC 333: The U.S. Congress 209 Graham Building Mondays & Wednesdays, 2:00-3:15 Spring Course Description

GEORGIA INSTITUTE OF TECHNOLOGY Sam Nunn School of International Affairs. Ethics in International Affairs INTA 2030 Spring Dr.

Instructional Unit Name of Unit/Big Idea: Physical Characteristics of Places Brief Description: Length of Course (Days/Weeks):

Grad School Coaching, LLC

The North Carolina Constitutional Convention of 1835 Overview Grade North Carolina Essential Standards Essential Questions Materials Duration

Designing a Social Network Prep for Lab 10. March 26, 2018 Sprenkle - CSCI Why classes and objects? How do we create new data types?

Mojdeh Nikdel Patty George

11/15/13. Objectives. Review. Our Screen Saver Dependencies. Our Screen Saver Dependencies. Project Deliverables Timeline TEAM FINAL PROJECT

American Politics Political Science 101 Spring 2004

PSC : American Politics 106 Graham Building MWF, 11:00-11:50 Fall 2012

Learning Expectations

East Georgia State College Social Sciences Division POLITICAL SCIENCE 1101 (CRN 20369; ; M/W/F) AMERICAN GOVERNMENT

PSC 306, Fall 2013 Prof. James E. Campbell. 14 Knox Hall :00 8:50pm Wednesdays

WEST LOS ANGELES COLLEGE POLITICAL SCIENCE 001 THE GOVERNMENT OF THE UNITED STATES

Hoboken Public Schools. College Algebra Curriculum

SYLLABUS AMERICAN GOVERNMENT I [POSC 1113]

ADVANCED DISCOVERY TECHNIQUES

POS 103, Introduction to Political Theory Peter Breiner

Hoboken Public Schools. PLTW Introduction to Computer Science Curriculum

Advanced Placement United States History Syllabus Rappahannock High School

PA 372 Comparative and International Administration

Master of Entertainment Industry Management

Maps and Hash Tables. EECS 2011 Prof. J. Elder - 1 -

Hoboken Public Schools. Forensics Curriculum

Federalism is. Head a piece of paper as you see below in your spiral. Today s Music Requests:

During this session we will cover all the learning objectives mentioned above.

Department of Political Science PSCI 350: Ideas, Campaigns, and Elections Fall 2012, Tuesday & Thursday, 1:00 2:15, Leak Room, Duke Hall

RODUCTION TO BROADCAST NEWS

Introduction to American Government

US History, Ms. Brown Website: dph7history.weebly.com

CITIZEN UPRISING TOOLKIT. Ballot Access Guide

Voting and Elections

From The Big Disconnect By PAUL KRUGMAN 9/1/06

HOW IT WORKS IMPORTANT DATES

Torts Office: Hazel Hall 307 Office Hours: Tuesday, 8:00 PM to. August 20 through November 27 Exam: Monday, Dec. 10 at 6:00 PM

Course Guidelines Math 433 Dr. R. Beezer Fall 2003

General Election Senate Candidate Orientation Session

Relationships for Results Handout

A Kit for Community Groups to Demystify Voting

Government Brochure Project

COURSE INFORMATION SHEET

Ninety-seven percent of all U.S. newspapers are small newspapers.

Romee Strijd VLOG 8 // FASHION WEEK

Political Science 452

Syllabus

Instructors: Tengyu Ma and Chris Re

Global Migration PSC 469, Spring 2017 Tu/Th 2:00--3:20 in HoL 107

POL2101 INTRODUCTION TO POLITICAL SCIENCE. Spring

Fall 2018 Political Science 100G How to Win (or lose) an Election Professor Nathan Fletcher

PSC : American Politics 212 Graham Building MWF, 10:00-10:50 Spring Course Description

INTL 3300: Introduction to Comparative Politics Fall Dr. Molly Ariotti M W F : 10:10-11 am Location: Candler Hall, Room 214 (BLDG 0031, RM 0214)

About Faculty Meeting

Hoboken Public Schools. AP Calculus Curriculum

Supporting Question(s): What was the treaty of Versailles? What were the negative consequences of the treaty? (Day 1 and 2)

Essential Patterns of Mature Agile Leadership

Transcription:

CSCI211: Intro Objectives Introduction to Algorithms, Analysis Course summary Reviewing proof techniques Jan 7, 2019 Sprenkle CSCI211 1 My Bio From Dallastown, PA B.S., Gettysburg College M.S., Duke University Ph.D., University of Delaware For fun: pop culture, gardening, volunteer at Rockbridge Animal Alliance Jan 7, 2019 Sprenkle CSCI211 2 1

What This Course Is About From 30 Rock Jan 7, 2019 Sprenkle CSCI211 3 Now, everything comes down to expert knowledge of algorithms and data structures. If you don't speak fluent O-notation, you may have trouble getting your next job at the technology companies in the forefront. -- Larry Freeman For me, great algorithms are the poetry of computation. Just like verse, they can be terse, allusive, dense, and even mysterious. But once unlocked, they cast a brilliant new light on some aspect of computing. -- Francis Sullivan Jan 7, 2019 Sprenkle CSCI211 4 2

Motivation From a Google interview preparation email Get your algorithms straight (they may comprise up to a third of your interview). Visit: http://en.wikipedia.org/wiki/list_of_algorithm_general_topics and examine this list of algorithms: http://en.wikipedia.org/wiki/list_of_algorithms and data structures: http://en.wikipedia.org/wiki/list_of_data_structures Write out all the algorithms yourself from start to finish and make sure they're working. Jan 7, 2019 Sprenkle CSCI211 5 What is an Algorithm? Precise procedure to solve a problem Completes in a finite number of steps Jan 7, 2019 Sprenkle CSCI211 6 3

Questions to Consider What are our goals when designing algorithms? How do we know when we ve met our goals? Goals: Correctness, Efficiency Use analysis to show/prove Jan 7, 2019 Sprenkle CSCI211 7 Course Goals Learn how to formulate precise problem descriptions Learn specific algorithm design techniques and how to apply them Learn how to analyze algorithms for efficiency and for correctness Learn when no exact, efficient solution is possible Jan 7, 2019 Sprenkle CSCI211 8 4

Course Content Algorithm analysis Ø Formal proofs; Asymptotic bounds Advanced data structures Ø e.g., heaps, graphs Greedy Algorithms Divide and Conquer Dynamic Programming Network Flow Computational Intractability Jan 7, 2019 Sprenkle CSCI211 9 Course Notes Textbook: Algorithm Design Participation is encouraged Ø Individual, row, class Assignments: Ø Reading text, writing brief summaries Readings through Friday due following Tuesday Ø Problem Sets Solutions to problems Analysis of solutions Programming (little) Given on Friday, due following Friday Jan 7, 2019 Sprenkle CSCI211 10 5

Course Grading 40% Individual written and programming homework assignments 30% Two midterm exams 20% Final 5% Text book reading summaries, weekly Ø In a journal on wiki 5% Participation and attendance Jan 7, 2019 Sprenkle CSCI211 11 Text Book Summaries in Journal Important for you to wrestle with material more than just during the class period Ø More than superficial understanding Understand problem, motivation, key insights, proof, analysis, Ø Make connections Ø Not all details can be covered in class Not just reading à active summaries Help you prepare for the week s problem set Jan 7, 2019 Sprenkle CSCI211 12 6

Journal Content Brief summary of chapter/section Ø ~1 paragraph of about 5-10 sentences/section Ø feel free to write more if that will help you Include motivations for the given problem, as appropriate For algorithms, brief sketch of algorithm, intuition, and implementation Ø Include runtime Questions you have about motivation/solution/proofs/analysis Discuss anything that makes more sense after reading it again, after it was presented in class (or vice versa) Anything that you want to remember, anything that will help you Say something about how readable/interesting the section was on scale of 1 to 10 Jan 7, 2019 Sprenkle CSCI211 13 Journal Grading Grade Meaning + Especially well-done, insightful questions - Typical grade Unsatisfactory write up; specific feedback about how to improve 0 No submission Jan 7, 2019 Sprenkle CSCI211 14 7

How to Succeed in This Course Come to every class prepared (bring questions!) Actively participate in class by asking and answering questions Actively read the textbook, making notes about the problems and solutions in your wiki. Do all the assignments--start them when they are assigned--and turn them in on time Ø Refer to your wiki, the lecture slides, and your notes when working on your assignments. If you start to get behind, see me in office hours right away http://cs.wlu.edu/~sprenkle/cs211 Jan 7, 2019 Sprenkle CSCI211 15 ALGORITHMS Jan 7, 2019 Sprenkle CSCI211 16 8

Computational Problem Solving 101 Computational Problem Ø A problem that can be solved by logic To solve the problem: 1. Create a model of the problem 2. Design an algorithm for solving the problem using the model 3. Write a program that implements the algorithm Jan 7, 2019 Sprenkle CSCI211 17 Computational Problem Solving 101 Algorithm: a well-defined recipe for solving a problem Ø Has a finite number of steps Ø Completes in a finite amount of time Program Ø An algorithm written in a programming language Ø Important to consider implementation s effect on runtime Jan 7, 2019 Sprenkle CSCI211 18 9

PROOFS Jan 7, 2019 Sprenkle CSCI211 19 Why Proofs? What are insufficient alternatives? How can we prove something isn t true? Jan 7, 2019 Sprenkle CSCI211 20 10

Why Proofs? What are insufficient alternatives? Ø Examples Considered all possible? Ø Empirical/statistical evidence Ex: Lying with statistics How can we prove something isn t true? Ø One counterexample Need irrefutable proof that something is true for all possibilities Jan 7, 2019 Sprenkle CSCI211 21 Soap Opera Proofs It s the only thing that makes sense. Jan 7, 2019 Sprenkle CSCI211 22 11

Common Types of Proofs? Jan 7, 2019 Sprenkle CSCI211 25 Common Types of Proofs Direct proofs Ø Series of true statements, each implies the next Proof by contradiction Proof by induction Jan 7, 2019 Sprenkle CSCI211 26 12

Proof By Contradiction What are the steps to a proof by contradiction? Jan 7, 2019 Sprenkle CSCI211 27 Proof By Contradiction 1. Assume the proposition (P) we want to prove is false 2. Reason to a contradiction 3. Conclude that P must therefore be true Jan 7, 2019 Sprenkle CSCI211 28 13

Prove: There are Infinitely Many Primes Jan 7, 2019 Sprenkle CSCI211 29 Prove: There are Infinitely Many Primes What is a prime number? What is not-a-prime number? What is our first step (proof by contradiction)? What do we want to show? Jan 7, 2019 Sprenkle CSCI211 30 14

Prove: There are Infinitely Many Primes Assume there are a finite number of prime numbers Ø List them: p 1, p 2..., p n Consider the number q = p 1 p 2... p n + 1 What are the possibilities for q? q is either composite or prime Jan 7, 2019 Sprenkle CSCI211 31 Prove: There are Infinitely Many Primes Assume there are a finite number of prime numbers Ø List them: p 1, p 2..., p n Consider the number q = p 1 p 2... p n + 1 Case: q is composite Ø If we divide q by any of the primes, we get a remainder of 1 à q is not composite Jan 7, 2019 Sprenkle CSCI211 32 15

Prove: There are Infinitely Many Primes Assume there are a finite number of prime numbers Ø List them: p 1, p 2..., p n Consider the number q = p 1 p 2... p n + 1 Case: q is composite Ø If we divide q by any of the primes, we get a remainder of 1 à q is not composite Therefore, q is prime, but q is larger than any of the finitely enumerated prime numbers listed à Contradiction Proof thanks to Euclid Jan 7, 2019 Sprenkle CSCI211 33 Proof By Induction What are the steps to a proof by induction? Jan 7, 2019 Sprenkle CSCI211 34 16

Proof By Induction 1. What you want to prove 2. Base case Ø Typical: Show statement holds for n = 0 or n = 1 3. Induction hypothesis 4. Induction step: show that adding one to n also holds true Ø Relies on earlier assumptions When/why is induction useful? Show true for all (infinite) possibilities Show works for one more Jan 7, 2019 Sprenkle CSCI211 35 Proof By Induction 1. State your P(n). Ø P(n) is a property as a function of n State for which n you will prove your P(n) to be true 2. State your base case. Ø State for which n your base case is true, and prove it Use the smallest n for which your statement is true 3. State your induction hypothesis Ø Without an induction hypothesis, the proof falls apart. Ø Usually it is just restating your P(n), with no restriction on n (an arbitrary n) 4. Inductive Step. Ø Consider P(n + 1). Try to prove a larger case of the problem than you assumed in your induction hypothesis. Ø Ø Keep in mind: What are you trying to prove? Use your induction hypothesis, and clearly state where it is used. If you haven t used your induction hypothesis, then you are not doing a proof by induction. 5. Conclusion. Ø Optionally, restate the problem. Jan 7, 2019 Sprenkle CSCI211 36 17

Example of Induction Proof Prove: 2+4+6+8+ + 2n = n*(n+1) Jan 7, 2019 Sprenkle CSCI211 37 Example of Induction Proof Prove: 2+4+6+8+ + 2n = n*(n+1) For what values of n do we want to prove this is true? A: where n is a natural number Jan 7, 2019 Sprenkle CSCI211 38 18

Example of Induction Proof Prove: 2+4+6+8+ + 2n = n*(n+1) Base case: n = 1 à Ø 2*1 = 1*(1+1) (where n is a natural number) Jan 7, 2019 Sprenkle CSCI211 39 Example of Induction Proof Prove: 2+4+6+8+ + 2n = n*(n+1) Base case: n = 1 à Ø 2*1 = 1*(1+1) Induction Hypothesis: (where n is a natural number) Ø Assume statement is true for some arbitrary k > 1 Jan 7, 2019 Sprenkle CSCI211 40 19

Example of Induction Proof Prove: 2+4+6+8+ + 2n = n*(n+1) Base case: n = 1 à Ø 2*1 = 1*(1+1) Induction Hypothesis: (where n is a natural number) Ø Assume statement is true for some arbitrary k > 1 Prove holds for k+1 Jan 7, 2019 Sprenkle CSCI211 41 Example of Induction Proof Prove: 2+4+6+8+ + 2n = n*(n+1) Base case: n = 1 à Ø 2*1 = 1*(1+1) Induction Hypothesis: (where n is a natural number) Ø Assume statement is true for some arbitrary k > 1 Prove holds for k+1, i.e., show that 2+4+6+8+ + 2k + 2(k+1) = (k+1)*((k+1)+1) Jan 7, 2019 Sprenkle CSCI211 42 20

Proof Prove: 2+4+6+8+ + 2n = n*(n+1) Base case: n = 1 à 2*1 = 1*(1+1) Assume statement is true for arbitrary n=k>1 Prove true for k+1, i.e., show that 2+4+6+8+ + 2k + 2(k+1) = (k+1)*((k+1)+1) Ø 2+4+6+8+ + 2k + 2(k+1) = k*(k+1) + 2(k+1) = k 2 + k + 2k + 1 = k 2 + 3k + 1 = (k+1)*(k+2) = (k+1)*((k+1)+1) Approach shown: transform LHS to RHS I want to see these steps in your proofs! Jan 7, 2019 Sprenkle CSCI211 43 Proof Prove: 2+4+6+8+ + 2n = n*(n+1) Base case: n = 1 à 2*1 = 1*(1+1) Assume statement is true for arbitrary n=k>1 Prove true for k+1, i.e., show that 2+4+6+8+ + 2k + 2(k+1) = (k+1)*((k+1)+1) Ø 2+4+6+8+ + 2k + 2(k+1) Alternative solution = k*(k+1) + 2(k+1) = (k+1)*(k+2), factor out the (k+1) = (k+1)*((k+1)+1) Jan 7, 2019 Sprenkle CSCI211 44 21

Proof Summary Need to prove conjectures Common types of proofs Ø Direct proofs Ø Contradiction Ø Induction Common error: not checking/proving assumptions Ø Jumps in logic Jan 7, 2019 Sprenkle CSCI211 45 Proof: All Horses Are The Same Color Base case: If there is only one horse, there is only one color. Induction step: Assume as induction hypothesis that within any set of n horses, there is only one color. Ø Look at any set of n + 1 horses Ø Label the horses: 1, 2, 3,..., n, n + 1 Ø Consider the sets {1, 2, 3,..., n} and {2, 3, 4,..., n + 1} Ø Each is a set of only n horses, therefore within each there is only one color Ø Since the two sets overlap, there must be only one color among all n + 1 horses Where is the error in the proof? Jan 7, 2019 Sprenkle CSCI211 46 22

Looking Ahead Check out course wiki page Ø Test username/password after email received Ø Decide which style of journal you want: wiki or blog Read first two pages of book s preface Ø Summarize on Wiki by next Tuesday @ midnight Jan 7, 2019 Sprenkle CSCI211 47 23