1 Module 2: Fundamental Concepts Problems Programs –Programming languages.

Slides:



Advertisements
Similar presentations
Etter/Ingber Engineering Problem Solving with C Fundamental Concepts Chapter 4 Modular Programming with Functions.
Advertisements

Formal Models of Computation Part III Computability & Complexity
College of Information Technology & Design
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 7- 1 Overview 7.1 Introduction to Arrays 7.2 Arrays in Functions 7.3.
Object Oriented Design An object combines data and operations on that data (object is an instance of class) data: class variables operations: methods Three.
1 Lecture 4 Topics –Problem solving Subroutine Theme –REC language class The class of solvable problems Closure properties.
1 Module 3: Classifying Problems One of the main themes of this course will be to classify problems in various ways –By solvability Solvable, “half-solvable”,
1 Lecture 4: Formal Definition of Solvability Analysis of decision problems –Two types of inputs:yes inputs and no inputs –Language recognition problem.
Hardness Results for Problems P: Class of “easy to solve” problems Absolute hardness results Relative hardness results –Reduction technique.
Lecture 9 Recursive and r.e. language classes
1 Lecture 14 Language class LFSA –Study limits of what can be done with FSA’s –Closure Properties –Comparing to other language classes.
1 Module 13 Studying the internal structure of REC, the set of solvable problems –Complexity theory overview –Automata theory preview Motivating Problem.
1 Module 9 Recursive and r.e. language classes –representing solvable and half-solvable problems Proofs of closure properties –for the set of recursive.
CSE115/ENGR160 Discrete Mathematics 02/24/11 Ming-Hsuan Yang UC Merced 1.
Lecture 2: Fundamental Concepts
Text Chapters 1, 2. Sorting ä Sorting Problem: ä Input: A sequence of n numbers ä Output: A permutation (reordering) of the input sequence such that:
1 Module 2: Fundamental Concepts Problems Programs –Programming languages.
Module 5 Topics Proof of the existence of unsolvable problems
1 Lecture 1: Course Overview Course: CSE 360 Instructor: Dr. Eric Torng TA: Huamin Chen.
1 Module 7 Halting Problem –Fundamental program behavior problem –A specific unsolvable problem –Diagonalization technique revisited Proof more complex.
1 Module 11 Proving more specific problems are not solvable Input transformation technique –Use subroutine theme to show that if one problem is unsolvable,
1 Lecture 10 Proving more specific problems are not recursive Reduction technique –Use subroutine theme to show that if one problem is unsolvable, so is.
1 Lecture 7 Halting Problem –Fundamental program behavior problem –A specific unsolvable problem –Diagonalization technique revisited Proof more complex.
CSE 830: Design and Theory of Algorithms
1 Lecture 2 Topics –Importance of this material Fundamental Limitations –Connecting Problems and Languages Problems –Search, function and decision problems.
1 Lecture 7 Halting Problem –Fundamental program behavior problem –A specific unsolvable problem –Diagonalization technique revisited Proof more complex.
1 Lecture 18 Closure Properties of Language class LFSA –Remember ideas used in solvable languages unit –Set complement –Set intersection, union, difference,
Chapter 1 pp 1-14 Properties of Algorithms Pseudocode.
1 Lecture 11 Proving more specific problems are not solvable Input transformation technique –Use subroutine theme to show that if one problem is unsolvable,
1 Module 11 Proving more specific problems are not solvable Input transformation technique –Use subroutine theme to show that if one problem is unsolvable,
1 Lecture 7 Topics –Problems about program behavior At least problem input is a program/algorithm –Halting Problem Fundamental problem about program behavior.
1 Module 4: Formal Definition of Solvability Analysis of decision problems –Two types of inputs:yes inputs and no inputs –Language recognition problem.
Turing Machines CS 105: Introduction to Computer Science.
1 Lecture 11 Proving more specific problems are not solvable Input transformation technique –Use subroutine theme to show that if one problem is unsolvable,
Hardness Results for Problems P: Class of “easy to solve” problems Absolute hardness results Relative hardness results –Reduction technique.
1 Module 10 Recursive and r.e. language classes –representing solvable and half-solvable problems Proofs of closure properties –for the set of recursive.
Hardness Results for Problems
1 Lecture 11 Studying structure of REC –Complexity theory overview –Automata theory preview Motivating Problem –string searching.
1 Lecture 14 Studying the internal structure of REC, the set of solvable problems –Complexity theory overview –Automata theory preview Motivating Problem.
The Fundamentals: Algorithms, the Integers & Matrices.
Chapter Complexity of Algorithms –Time Complexity –Understanding the complexity of Algorithms 1.
ดร.สุรศักดิ์ มังสิงห์ SPU, Computer Science Dept.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
Fall 2002CMSC Discrete Structures1 Enough Mathematical Appetizers! Let us look at something more interesting: Algorithms.
Introduction to Data Structures and Algorithms CS 110: Data Structures and Algorithms First Semester,
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
Artificial Intelligence: Introduction Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
Chapter Algorithms 3.2 The Growth of Functions 3.3 Complexity of Algorithms 3.4 The Integers and Division 3.5 Primes and Greatest Common Divisors.
Lecture 11 Data Structures, Algorithms & Complexity Introduction Dr Kevin Casey BSc, MSc, PhD GRIFFITH COLLEGE DUBLIN.
Copyright © Cengage Learning. All rights reserved.
Algorithms 1.Notion of an algorithm 2.Properties of an algorithm 3.The GCD algorithm 4.Correctness of the GCD algorithm 5.Termination of the GCD algorithm.
Algorithms Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Copyright © 2006 by Maria Litvin, Gary Litvin,
ALGORITHMS.
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
2IS80 Fundamentals of Informatics Fall 2015 Lecture 6: Sorting and Searching.
1 Module 17 Closure Properties of Language class LFSA –Remember ideas used in solvable languages unit –Set complement –Set intersection, union, difference,
Introductory Lecture. What is Discrete Mathematics? Discrete mathematics is the part of mathematics devoted to the study of discrete (as opposed to continuous)
Introduction to Algorithms
COP 3503 FALL 2012 Shayan Javed Lecture 15
Data Structures and Algorithms
Enough Mathematical Appetizers!
Lecture 2: Introduction to Algorithms
COMS W1004 Introduction to Computer Science and Programming in Java
Algorithms Chapter 3 With Question/Answer Animations
Applied Discrete Mathematics Week 6: Computation
Introduction to Algorithms
Enough Mathematical Appetizers!
Enough Mathematical Appetizers!
Algorithms.
Discrete Mathematics CS 2610
Presentation transcript:

1 Module 2: Fundamental Concepts Problems Programs –Programming languages

2 Problems We view solving problems as the main application for computer programs

3 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) Definition A problem is a mapping or function between a set of inputs and a set of outputs Example Problem: Sorting

4 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

5 Example Problem Specifications* –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

6 Programs Programs solve problems

7 Purpose Why do we write programs? One answer –To solve problems –What does it mean to solve a problem? Informal answer: For every legal input, a correct output is produced. Formal answer: To be given later

8 Programming Language Definition –A programming language defines what constitutes a legal program –Example: a pseudocode program may not be a legal C++ program which may not be a legal C program –A programming language is typically referred to as a “computational model” in a course like this.

9 C++ Our programming language will be C++ with minor modifications –Main procedure will use input parameters in a fashion similar to other procedures no argc/argv –Output will be returned type specified by main function type

10 Maximum Element Problem Input –integer n >= 1 –List of n integers Output –The largest of the n integers

11 C++ Program which solves the Maximum Element Problem* int main(int A[], int n) { int i, max; if (n < 1) return (“Illegal Input”); max = A[0]; for (i = 1; i < n; i++) if (A[i] > max) max = A[i]; return (max); }

12 Fundamental Theme Exploring capabilities and limitations of C++ programs

13 Restating the Fundamental Theme We will study the capabilities and limits of C++ programs Specifically, we will try and identify –What problems can be solved by C++ programs –What problems cannot be solved by C++ programs

14 Studying the Theme How do we prove a problem CAN be solved by SOME C++ program? –We write a specific C++ program which solves it. How do we prove something CANNOT be solved by ANY C++ program? –We have to develop an argument which takes into account EVERY C++ program that could be written.

15 Question Is C++ general enough? Or is it possible that there exists some problem  such that –  can be solved by some program P in some other reasonable programming language –but  cannot be solved by any C++ program?

16 Church’s Thesis (modified) We have no proof of an answer, but it is commonly accepted that the answer is no. Church’s Thesis (three identical statements) –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

17 Summary * Problems –When we talk about what programs can or cannot “DO”, we mean what PROBLEMS can or cannot be solved Questions –For any problem, can there be more than one program which solves it? –For any program, can it solve more than one problem? –Which is harder: proving a problem solvable or unsolvable?