Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Lecture 1: Course Overview Course: CSE 360 Instructor: Dr. Eric Torng TA: Huamin Chen.

Similar presentations


Presentation on theme: "1 Lecture 1: Course Overview Course: CSE 360 Instructor: Dr. Eric Torng TA: Huamin Chen."— Presentation transcript:

1 1 Lecture 1: Course Overview Course: CSE 360 Instructor: Dr. Eric Torng TA: Huamin Chen

2 2 Topics Course Overview –Algorithms Models of Computation –Problems Functions or Program Specification –What we will be doing in this course

3 3 What do people do with computers? One answer –Run programs on them.

4 4 What is a program? Algorithm –define difference later List of instructions –finite –definite; no ambiguity

5 5 Examples Dough recipe Maximum program

6 6 Dough recipe Ingredients –3 cups flour –1 cup water Instructions –bring water to boil –thoroughly mix flour and boiling water –refrigerate overnight

7 7 Maximum program Variables –integer array A[100] –integer max, i; Instructions –max = A[0]; –for (i=1;i<100;i++) IF A[i] > max THEN max = A[i]; –return max;

8 8 Models of Computation A model of computation is a programming language –Defines concept of legal programs Dough recipe is not a legal computer program Main constraints –available resources –possible operations –(also other parameters)

9 9 Difference between program and algorithm Algorithm –high level idea Program –implementation of algorithm in a specific programming language/computational model Different programs can implement the same high level algorithm

10 10 Initial Model of Computation C ++ programming language Modified Church’s Thesis –C ++ is a general model of computation Any algorithm can be expressed as a C ++ program If some algorithm cannot be expressed by a C ++ program, it cannot be expressed in any reasonable programming language

11 11 What does an algorithm do? A specific program/algorithm is written to solve a specific problem.

12 12 What is a problem? A problem is a mapping or function between a set of inputs and a set of outputs Example –Sorting problem –Input x: 4 2 3 1 –Output f(x): 1 2 3 4

13 13 Sorting problem Inputs Outputs (4,2,3,1) (3,1,2,4) (7,5,1) (1,2,3) (1,2,3,4) (1,5,7) (1,2,3)

14 14 How to specify a problem Input –Describe what an input instance looks like Output –Describe what task should be performed on the input –In particular, describe what output should be produced

15 15 Example Problems –Sorting Problem Input –Integers n 1, n 2,..., n k Output –n 1, n 2,..., n k in nondecreasing order –Find element problem Input –Integers n 1, n 2, …, n k –Search key S Output –yes if S is in n 1, n 2, …, n k, no otherwise

16 16 Observation A problem is a SPECIFICATION for a program –In our case, a problem is very cleanly defined and thus there should be little ambiguity in what is being requested –This is not always true in real life

17 17 What a computer programmer does: 1) Client gives a problem description to the programmer –often unclear –ask questions! 2) You design an algorithm/program to solve the problem.

18 18 What do people do with problems? In programming courses –Develop programs to solve these problems In this course –1) We will show there exist problems which cannot be solved by any C++ program Church’s Thesis –What is it and why is it important in this context? Techniques used –Diagonalization technique –Reduction technique

19 19 What will we do in this course? –2) We then will study restricted computational models Study what can be done Study what cannot be done

20 20 Quick Review Group work –What is a “model of computation”? –What is a problem? –How do we specify a problem? –What do programming courses teach you to do with problems? –What is one thing we are going to teach you about problems in this course?

21 21 Key Concepts Algorithms and programs –models of computation/programming languages Problems –function –program specification Unsolvable problems


Download ppt "1 Lecture 1: Course Overview Course: CSE 360 Instructor: Dr. Eric Torng TA: Huamin Chen."

Similar presentations


Ads by Google