Introduction to CS 4104

Similar documents
CSE 421 Algorithms. Richard Anderson Autumn 2015 Lecture 1

CSE 101. Algorithm Design and Analysis Miles Jones Office 4208 CSE Building Lecture 1: Introduction

COS 341 Discrete Mathematics

CSEP 521 Applied Algorithms. Richard Anderson Winter 2013 Lecture 1

CS483 Design and Analysis of Algorithms

Computational Models

Intermediate Algebra

Algorithms Exam TIN093 /DIT602

Math/EECS 1028M: Discrete Mathematics for Engineers Winter Suprakash Datta

Linear Algebra. Instructor: Justin Ryan

Algorithms. [Knuth, TAOCP] An algorithm is a finite, definite, effective procedure, with some input and some output.

Course Structure. Computer Science 2300: Data Structures and Algorithms. What is this class about? Textbooks

SE 2FA3: Discrete Mathematics and Logic II. Teaching Assistants: Yasmine Sharoda,

Introduction Propositional Logic

Physics 9, Introductory Physics II Spring 2010

MATH 122 SYLLBAUS HARVARD UNIVERSITY MATH DEPARTMENT, FALL 2014

Important Dates. Non-instructional days. No classes. College offices closed.

MATH 341, Section 001 FALL 2014 Introduction to the Language and Practice of Mathematics

Math 1190/01 Calculus I Fall 2007

Chemistry 14C: Structure of Organic Molecules - Winter 2017 Version 56

Math 200 A and B: Linear Algebra Spring Term 2007 Course Description

Math 1553 Introduction to Linear Algebra. School of Mathematics Georgia Institute of Technology

Fall 2014: PHYSICS 170 GENERAL PHYSICS I

CS Module 1. Ben Harsha Apr 12, 2017

Introductory Probability

PHYS 480/580 Introduction to Plasma Physics Fall 2017

Modesto Junior College Course Outline of Record MATH 20

Leon, Chap. 1. Chap. 2

AE 200 Engineering Analysis and Control of Aerospace Systems

Welcome to Physics 161 Elements of Physics Fall 2018, Sept 4. Wim Kloet

PH 610/710-2A: Advanced Classical Mechanics I. Fall Semester 2007

Course Staff. Textbook

MAT01A1. Appendix E: Sigma Notation

ME DYNAMICAL SYSTEMS SPRING SEMESTER 2009

Introduction Introduction. Discrete Mathematics Andrei Bulatov

CHEMISTRY 3A INTRODUCTION TO CHEMISTRY SPRING

Math 31 Lesson Plan. Day 2: Sets; Binary Operations. Elizabeth Gillaspy. September 23, 2011

MATH 345 Differential Equations

Introduction. An Introduction to Algorithms and Data Structures

Fundamentals of Mathematics (MATH 1510)

ABOUT THE CLASS AND NOTES ON SET THEORY

Columbus State Community College Mathematics Department Public Syllabus

JEFFERSON COLLEGE COURSE SYLLABUS MTH 110 INTRODUCTORY ALGEBRA. 3 Credit Hours. Prepared by: Skyler Ross & Connie Kuchar September 2014

AS The Astronomical Universe. Prof. Merav Opher - Fall 2013

Physics 162a Quantum Mechanics

CS684 Graph Algorithms

Homework #2 Solutions Due: September 5, for all n N n 3 = n2 (n + 1) 2 4

Instructor Dr. Tomislav Pintauer Mellon Hall Office Hours: 1-2 pm on Thursdays and Fridays, and by appointment.

CSC 344 Algorithms and Complexity. Proof by Mathematical Induction

Math , Fall 2014 TuTh 12:30pm - 1:45pm MTH 0303 Dr. M. Machedon. Office: Math Office Hour: Tuesdays and

AMSC/MATH 673, CLASSICAL METHODS IN PDE, FALL Required text: Evans, Partial Differential Equations second edition

MATH 450: Mathematical statistics

Important Dates. Non-instructional days. No classes. College offices closed.

Physics 112 for class and recitation WF 10:10 a.m. - 10:40 a.m. or by appointment

Physics 9, Introductory Physics II Fall 2011

JEFFERSON COLLEGE COURSE SYLLABUS MTH 110 INTRODUCTORY ALGEBRA. 3 Credit Hours. Prepared by: Skyler Ross & Connie Kuchar September 2014

Syllabus. Physics 0847, How Things Work Section II Fall 2014


JEFFERSON COLLEGE COURSE SYLLABUS. MTH 201 CALCULUS III 5 Credit Hours. Prepared by: John M Johny August 2012

Physics 18, Introductory Physics I for Biological Sciences Spring 2010

Modesto Junior College Course Outline of Record MATH 70

Biology 580 Cellular Physiology Spring 2007 Course Syllabus

Do not turn this page until you have received the signal to start. Please fill out the identification section above. Good Luck!

IST 4 Information and Logic

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

San Jose State University Department of Mechanical and Aerospace Engineering ME 211, Advanced Heat Transfer, Fall 2015

Algorithms and Theory of Computation. Lecture 1: Introduction, Basics of Algorithms

Math 2802 Applications of Linear Algebra. School of Mathematics Georgia Institute of Technology

Math 3B: Lecture 1. Noah White. September 23, 2016

Physics 321 Theoretical Mechanics I. University of Arizona Fall 2004 Prof. Erich W. Varnes

SAVE THIS SYLLABUS FOR REFERENCE DURING THE SEMESTER.

Welcome to Physics 211! General Physics I

Calculus And Analytic Geometry By Thomas Finney 11th Edition

AS 102 The Astronomical Universe (Spring 2010) Lectures: TR 11:00 am 12:30 pm, CAS Room 316 Course web page:

SYLLABUS SEFS 540 / ESRM 490 B Optimization Techniques for Natural Resources Spring 2017

PHYS F212X FE1+FE2+FE3

Greedy Algorithms. CSE 101: Design and Analysis of Algorithms Lecture 10

MATH COURSE TITLE: College Algebra

COURSE INFORMATON. EE529 Fall Assoc. Prof. Dr. Cahit Canbay. Assoc. Prof. Dr. Cahit Canbay

Lecture 1. EE70 Fall 2007

CHEMISTRY 121 FG Spring 2013 Course Syllabus Rahel Bokretsion Office 3624, Office hour Tuesday 11:00 AM-12:00 PM

Derivatives and series FTW!

HEAT AND THERMODYNAMICS PHY 522 Fall, 2010

CSE507. Course Introduction. Computer-Aided Reasoning for Software. Emina Torlak

Math 31 Lesson Plan. Day 5: Intro to Groups. Elizabeth Gillaspy. September 28, 2011

Math 3B: Lecture 1. Noah White. September 29, 2017

ELECTRIC CIRCUITS I (ELCT 301)

Announcements Monday, September 18

Reid State Technical College

Monday May 12, :00 to 1:30 AM

AS 101: The Solar System (Spring 2017) Course Syllabus

Geography 1103: Spatial Thinking

Reid State Technical College

Math 1553 Introduction to Linear Algebra. School of Mathematics Georgia Institute of Technology

Mathematical Induction

Kathleen A. Acker Robert McGee Carol Serotta. Cabrini College Colloquium October (c) 2010 Kathleen A. Acker, Ph.D.

Today s Outline. Biostatistics Statistical Inference Lecture 01 Introduction to BIOSTAT602 Principles of Data Reduction

M17 MAT25-21 HOMEWORK 6

Wednesday, 10 September 2008

Transcription:

Introduction to CS 4104 T. M. Murali August 24, 2009

Instructor Course Information T. M. Murali, 2160B Torgerson, 231-8534, murali@cs.vt.edu Oce Hours: 9:30am11:30am Mondays and Wednesdays Teaching assistant Chris Poirel, poirel@vt.edu Oce Hours: to be decided

Instructor Course Information T. M. Murali, 2160B Torgerson, 231-8534, murali@cs.vt.edu Oce Hours: 9:30am11:30am Mondays and Wednesdays Teaching assistant Chris Poirel, poirel@vt.edu Oce Hours: to be decided Class meeting time MW 2:30pm3:45pm, McBryde 134

Instructor Course Information T. M. Murali, 2160B Torgerson, 231-8534, murali@cs.vt.edu Oce Hours: 9:30am11:30am Mondays and Wednesdays Teaching assistant Chris Poirel, poirel@vt.edu Oce Hours: to be decided Class meeting time MW 2:30pm3:45pm, McBryde 134 Keeping in Touch Course web site http://courses.cs.vt.edu/~cs4104/spring2009, updated regularly through the semester Listserv: cs4104_91844@listserv.vt.edu

Instructor Course Information T. M. Murali, 2160B Torgerson, 231-8534, murali@cs.vt.edu Oce Hours: 9:30am11:30am Mondays and Wednesdays Teaching assistant Chris Poirel, poirel@vt.edu Oce Hours: to be decided Class meeting time MW 2:30pm3:45pm, McBryde 134 Keeping in Touch Course web site http://courses.cs.vt.edu/~cs4104/spring2009, updated regularly through the semester Listserv: cs4104_91844@listserv.vt.edu Prerequisites: CS 2604 or CS 2606, MATH 3134 or MATH 3034

Required Course Textbook Algorithm Design Jon Kleinberg and Éva Tardos Addison-Wesley 2006 ISBN: 0-321-29535-8

Course Goals Learn methods and principles to construct algorithms. Learn techniques to analyze algorithms mathematically for correctness and eciency (e.g., running time and space used). Course roughly follows the topics suggested in textbook Measures of algorithm complexity Graphs Greedy algorithms Divide and conquer Dynamic programming Network ow problems NP-completeness

Required Readings Reading assignment available on the website. Read before class.

Lecture Slides Will be available on class web site. Usually posted just before class. Class attendance is extremely important.

Lecture Slides Will be available on class web site. Usually posted just before class. Class attendance is extremely important. Lecture in class contains signicant and substantial additions to material on the slides.

Homeworks Posted on the web site one week before due date. Announced on the class listserv. Prepare solutions digitally but hand in hard-copy.

Homeworks Posted on the web site one week before due date. Announced on the class listserv. Prepare solutions digitally but hand in hard-copy. Solution preparation recommended in L ATEX.

Examinations Take-home midterm. Take-home nal (comprehensive). Prepare digital solutions (recommend L A TEX).

Examinations Take-home midterm. Take-home nal (comprehensive). Prepare digital solutions (recommend L A TEX). Examinations may change to be in class.

Grades Homeworks: 8, 60% of the grade. Take-home midterm: 15% of the grade. Take-home nal: 25% of the grade.

What is an Algorithm?

What is an Algorithm? Chamber's A set of prescribed computational procedures for solving a problem; a step-by-step method for solving a problem. Knuth, TAOCP An algorithm is a nite, denite, eective procedure, with some input and some output.

Origin of the word Algorithm 1. From the Arabic al-khwarizmi, a native of Khwarazm, a name for the 9th century mathematician, Abu Ja'far Mohammed ben Musa.

Origin of the word Algorithm 1. From the Arabic al-khwarizmi, a native of Khwarazm, a name for the 9th century mathematician, Abu Ja'far Mohammed ben Musa. 2. From Al Gore, the former U.S. vice-president who invented the internet.

Origin of the word Algorithm 1. From the Arabic al-khwarizmi, a native of Khwarazm, a name for the 9th century mathematician, Abu Ja'far Mohammed ben Musa. 2. From Al Gore, the former U.S. vice-president who invented the internet. 3. From the Greek algos (meaning pain, also a root of analgesic) and rythmos (meaning ow, also a root of rhythm).

Origin of the word Algorithm 1. From the Arabic al-khwarizmi, a native of Khwarazm, a name for the 9th century mathematician, Abu Ja'far Mohammed ben Musa. 2. From Al Gore, the former U.S. vice-president who invented the internet. 3. From the Greek algos (meaning pain, also a root of analgesic) and rythmos (meaning ow, also a root of rhythm). Pain owed through my body whenever I worked on CS 4104 homeworks. former student.

Origin of the word Algorithm 1. From the Arabic al-khwarizmi, a native of Khwarazm, a name for the 9th century mathematician, Abu Ja'far Mohammed ben Musa. He wrote Kitab al-jabr wa'l-muqabala, which evolved into today's high school algebra text. 2. From Al Gore, the former U.S. vice-president who invented the internet. 3. From the Greek algos (meaning pain, also a root of analgesic) and rythmos (meaning ow, also a root of rhythm). Pain owed through my body whenever I worked on CS 4104 homeworks. former student.

Problem Example Find Minimum INSTANCE: Nonempty list x 1, x 2,..., x n of integers. SOLUTION: Pair (i, x i ) such that x i = min{x j 1 j n}.

Algorithm Example Find-Minimum(x 1, x 2,..., x n ) 1 i 1 2 for j 2 to n 3 do if x j < x i 4 then i j 5 return (i, x i )

Running Time of Algorithm Find-Minimum(x 1, x 2,..., x n ) 1 i 1 2 for j 2 to n 3 do if x j < x i 4 then i j 5 return (i, x i )

Running Time of Algorithm Find-Minimum(x 1, x 2,..., x n ) 1 i 1 2 for j 2 to n 3 do if x j < x i 4 then i j 5 return (i, x i ) At most 2n 1 assignments and n 1 comparisons.

Correctness of Algorithm: Proof 1 Find-Minimum(x 1, x 2,..., x n) 1 i 1 2 for j 2 to n 3 do if x j < x i 4 then i j 5 return (i, x i )

Correctness of Algorithm: Proof 1 Find-Minimum(x 1, x 2,..., x n) 1 i 1 2 for j 2 to n 3 do if x j < x i 4 then i j 5 return (i, x i ) Proof by contradiction:

Correctness of Algorithm: Proof 1 Find-Minimum(x 1, x 2,..., x n) 1 i 1 2 for j 2 to n 3 do if x j < x i 4 then i j 5 return (i, x i ) Proof by contradiction: Suppose algorithm returns (k, x k ) but there exists 1 l n such that x l < x k and x l = min{x j 1 j n}.

Correctness of Algorithm: Proof 1 Find-Minimum(x 1, x 2,..., x n) 1 i 1 2 for j 2 to n 3 do if x j < x i 4 then i j 5 return (i, x i ) Proof by contradiction: Suppose algorithm returns (k, x k ) but there exists 1 l n such that x l < x k and x l = min{x j 1 j n}. Is k < l?

Correctness of Algorithm: Proof 1 Find-Minimum(x 1, x 2,..., x n) 1 i 1 2 for j 2 to n 3 do if x j < x i 4 then i j 5 return (i, x i ) Proof by contradiction: Suppose algorithm returns (k, x k ) but there exists 1 l n such that x l < x k and x l = min{x j 1 j n}. Is k < l? No. Since the algorithm returns (k, x k ), x k x j, for all k < j n. Therefore l < k.

Correctness of Algorithm: Proof 1 Find-Minimum(x 1, x 2,..., x n) 1 i 1 2 for j 2 to n 3 do if x j < x i 4 then i j 5 return (i, x i ) Proof by contradiction: Suppose algorithm returns (k, x k ) but there exists 1 l n such that x l < x k and x l = min{x j 1 j n}. Is k < l? No. Since the algorithm returns (k, x k ), x k x j, for all k < j n. Therefore l < k. What does the algorithm do when j = l? It must set i to l, since we have been told that x l is the smallest element. What does the algorithm do when j = k (which happens after j = l)? Since x l < x k, the value of i does not change. Therefore, the algorithm does not return (k, x k ) yielding a contradiction.

Correctness of Algorithm: Proof 2 Find-Minimum(x 1, x 2,..., x n) 1 i 1 2 for j 2 to n 3 do if x j < x i 4 then i j 5 return (i, x i ) Proof by induction: What is true at the end of each iteration?

Correctness of Algorithm: Proof 2 Find-Minimum(x 1, x 2,..., x n) 1 i 1 2 for j 2 to n 3 do if x j < x i 4 then i j 5 return (i, x i ) Proof by induction: What is true at the end of each iteration? Claim: x i = min{x m 1 m j}, for all 1 j n. Claim is true

Correctness of Algorithm: Proof 2 Find-Minimum(x 1, x 2,..., x n) 1 i 1 2 for j 2 to n 3 do if x j < x i 4 then i j 5 return (i, x i ) Proof by induction: What is true at the end of each iteration? Claim: x i = min{x m 1 m j}, for all 1 j n. Claim is true algorithm is correct (set j = n).

Correctness of Algorithm: Proof 2 Find-Minimum(x 1, x 2,..., x n) 1 i 1 2 for j 2 to n 3 do if x j < x i 4 then i j 5 return (i, x i ) Proof by induction: What is true at the end of each iteration? Claim: x i = min{x m 1 m j}, for all 1 j n. Claim is true algorithm is correct (set j = n). Proof of the claim involves three steps. 1. Base case: j = 1 (before loop). x i = min{x m 1 m 1} is trivially true. 2. Inductive hypothesis: Assume x i = min{x m 1 m j}. 3. Inductive step: Prove x i = min{x m 1 m j + 1}. In the loop, i is set to be j + 1 if and only if xj+1 < x i. Therefore, xi is the smallest of x 1, x 2,..., x j+1 after the loop

Format of Proof by Induction Goal: prove some proposition P(n) is true for all n. Strategy: prove base case, assume inductive hypothesis, prove inductive step.

Format of Proof by Induction Goal: prove some proposition P(n) is true for all n. Strategy: prove base case, assume inductive hypothesis, prove inductive step. Base case: prove that P(1) or P(2) (or P(small number)) is true. Inductive hypothesis: assume P(n 1) is true. Inductive step: prove that P(n 1) P(n).

Format of Proof by Induction Goal: prove some proposition P(n) is true for all n. Strategy: prove base case, assume inductive hypothesis, prove inductive step. Base case: prove that P(1) or P(2) (or P(small number)) is true. Inductive hypothesis: assume P(n 1) is true. Inductive step: prove that P(n 1) P(n). Why does this strategy work?

Sum of rst n natural numbers P(n) = n i=1 i =

Sum of rst n natural numbers P(n) = n i=1 i = n(n + 1). 2

Recurrence Relation Given P(n) = { P( n ) + 1 if n > 1 2 1 if n = 1 prove that P(n)

Recurrence Relation Given P(n) = { P( n ) + 1 if n > 1 2 1 if n = 1 prove that P(n) 1 + log 2 n.

Recurrence Relation Given P(n) = { P( n ) + 1 if n > 1 2 1 if n = 1 prove that P(n) 1 + log 2 n. Use strong induction: In the inductive hypothesis, assume that P(i) is true for all i < n.