Module 3: Classifying Problems - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Module 3: Classifying Problems

Description:

All finite domain problems can be solved using 'table lookup' idea. Finite. Domain. Infinite ... Same is not true for finite domain problems. Table lookup ... – PowerPoint PPT presentation

Number of Views:15
Avg rating:3.0/5.0
Slides: 20
Provided by: Eri770
Learn more at: http://www.cse.msu.edu
Category:

less

Transcript and Presenter's Notes

Title: Module 3: Classifying Problems


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, unsolvable
  • We will focus our study on decision problems
  • function (one correct answer for every input)
  • finite range (yes or no is the correct output)

2
Classification Process
  • Take some set of problems and partition it into
    two or more subsets of problems where membership
    in a subset is based on some shared problem
    characteristic

3
Classify by Solvability
  • Criteria used is whether or not the problem is
    solvable
  • that is, does there exist a C program which
    solves the problem?

4
Function Problems
  • We will focus on problems where the mapping from
    input to output is a function

5
General (Relation) Problem
  • the mapping is a relation
  • that is, more than one output is possible for a
    given input

6
Criteria for Function Problems
  • mapping is a function
  • unique output for each input

7
Example Non-Function Problem
  • Divisor Problem
  • Input Positive integer n
  • Output A positive integral divisor of n

9
8
Example Function Problems
  • Sorting
  • Multiplication Problem
  • Input 2 integers x and y
  • Output xy

2,5
9
Another Example
  • Maximum divisor problem
  • Input Positive integer n
  • Output size of maximum divisor of n smaller than
    n

9
10
Decision Problems
  • We will focus on function problems where the
    correct answer is always yes or no

11
Criteria for Decision Problems
  • Output is yes or no
  • range Yes, No
  • Note, problem must be a function problem
  • only one of Yes/No is correct

12
Example
  • Decision sorting
  • Input list of integers
  • Yes/No question Is the list in nondecreasing
    order?

13
Another Example
  • Decision multiplication
  • Input Three integers x, y, z
  • Yes/No question Is xy z?

14
A Third Example
  • Decision Divisor Problem
  • Input Two integers x and y
  • Yes/No question Is y a divisor of x?

15
Focus on Decision Problems
  • When studying solvability, we are going to focus
    specifically on decision problems
  • There is no loss of generality, but we will not
    explore that here

16
Finite Domain Problems
  • These problems have only a finite number of inputs

17
Lack of Generality
  • All finite domain problems can be solved using
    table lookup idea

18
Table Lookup Program
  • int main(string x)
  • switch x
  • case Bill return(3)
  • case Judy return(25)
  • case Tom return(30)
  • default cerr ltlt Illegal input\n

19
Key Concepts
  • Classification Theme
  • Decision Problems
  • Important subset of problems
  • We can focus our attention on decision problems
    without loss of generality
  • Same is not true for finite domain problems
  • Table lookup
Write a Comment
User Comments (0)
About PowerShow.com