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

College of Information Technology & Design
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.
CS Section 600 CS Section 002 Dr. Angela Guercio Spring 2010.
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.
1 Module 2: Fundamental Concepts Problems Programs –Programming languages.
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:
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 Lecture 10 Proving more specific problems are not recursive Reduction technique –Use subroutine theme to show that if one problem is unsolvable, so is.
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 18 Closure Properties of Language class LFSA –Remember ideas used in solvable languages unit –Set complement –Set intersection, union, difference,
Foundations of (Theoretical) Computer Science
Chapter 1 pp 1-14 Properties of Algorithms Pseudocode.
Module 12 Computation and Configurations Formal Definition Examples.
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.
Arrays. Objectives Learn about arrays Explore how to declare and manipulate data into arrays Learn about “array index out of bounds” Become familiar with.
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 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.
1 Design and Analysis of Algorithms تصميم وتحليل الخوارزميات (311 عال) Chapter 1 Introduction to Algorithms.
Discrete Structures Lecture 11: Algorithms Miss, Yanyan,Ji United International College Thanks to Professor Michael Hvidsten.
ดร.สุรศักดิ์ มังสิงห์ 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,
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.
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 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 2 The Fundamentals: Algorithms,
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2008 Pearson Education, Inc., Upper.
Arrays Declaring arrays Passing arrays to functions Searching arrays with linear search Sorting arrays with insertion sort Multidimensional arrays Programming.
1 Introduction to Turing Machines
Introduction to Algorithms
Growth of Functions & Algorithms
Applied Discrete Mathematics Week 2: Functions and Sequences
COP 3503 FALL 2012 Shayan Javed Lecture 15
Computer Programming BCT 1113
Data Structures and Algorithms
Lecture 2 of Computer Science II
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!
Revision of C++.
Discrete Mathematics and its Applications
Enough Mathematical Appetizers!
Algorithms.
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 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?

15 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

16 Summary * Problems –When we talk about what programs can or cannot “DO”, we mean what PROBLEMS can or cannot be solved