lecture 4 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Lecture 4 PowerPoint Presentation
Download Presentation
Lecture 4

Loading in 2 Seconds...

play fullscreen
1 / 17

Lecture 4 - PowerPoint PPT Presentation


  • 98 Views
  • Uploaded on

Lecture 4. Topics Problem solving Subroutine Theme REC language class The class of solvable problems Closure properties. Problem Solving. Solving problems In this course, we spend a lot of time proving there are unsolvable problems

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Lecture 4' - ima


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
lecture 4
Lecture 4
  • Topics
    • Problem solving
      • Subroutine Theme
    • REC language class
      • The class of solvable problems
      • Closure properties
problem solving
Problem Solving
  • Solving problems
    • In this course, we spend a lot of time proving there are unsolvable problems
    • In today’s class, we will spend time doing the opposite: solving problems
  • Subroutines
    • Using an algorithm for one problem to help build an algorithm to solve a second problem
problem 1
Problem 1
  • Prime Number Problem
    • Input: Positive integer n
    • Yes/No Question: Is n a prime number?
  • Questions
    • What kind of problem is this?
    • Construct a solution to this problem
problem 2
Problem 2
  • Maximum clique problem
    • Input: Graph G = (V,E)
      • list of nodes and edges
    • Output: Size of maximum clique in G
  • Definitions
    • V: Set of n nodes {vi | 1 <= i <= n}
    • E: Set of edges {(vi, vj)}
    • Clique: subset C of V such that there is an edge between all nodes in C
example
Example

v1

v2

v3

v6

v5

v4

V = {v1, v2, v3, v4, v5, v6}

E = {(v1, v2), (v1, v5), (v1, v6), (v2, v3), (v2, v4), (v3, v4),

(v4, v5), (v5, v6)}

Question: How could we encode a graph as a string?

example 2
Example 2

v1

v2

v3

v6

v5

v4

V = {v1, v2, v3, v4, v5, v6}

E = {

Max clique size?

Smallest number of edges needed to increase m. c. size?

algorithm 1
Algorithm 1
  • Construct an algorithm for solving the max clique problem
problem 21
Problem 2’
  • Decision clique problem
    • Input: Graph G = (V,E), integerk
      • Note the extra input object k
    • Yes/No question:
      • Does the maximum clique in G have size at least k?
subroutine theme
Subroutine Theme
  • Assume that algorithm A solves the decision clique problem
  • Construct an algorithm A’ for solving the max clique problem that uses A as a subroutine
example from divisor problem
Example from divisor problem

integer x, max, j;

cin >> x;

max = 1;

for (j=2; j<x; j++)

if (A(x,j)) // using A as a procedure

max = j;

return max;

problem 3
Problem 3
  • Connected graph problem
    • Input: Graph G = (V,E)
      • list of nodes and edges
    • Yes/No Question: Is there a path of edges between every pair of nodes?
  • Construct an algorithm to solve this problem
slide12

REC

The class of solvable problems

programs and inputs
Programs and Inputs
  • Suppose we have a language L
  • In order for P to solve the language recognition problem associated with L, what should P do on a given string x
    • P should halt after a finite amount of time
    • P should correctly respond yes/no with respect to “Is x in L?”
slide14
REC
  • Formal Definition
    • A C++ program Pdecides language L iff
      • 1) Program P halts on all input strings
      • 2) Program P correctly labels all strings it halts on as in or not in L.
    • A language L is recursive or decidable iff there exists a C++ program P which decides L.
      • What if there is a Java program P which decides L?
    • REC: the set of recursive languages
church s thesis
Church’s Thesis
  • What is our modified Church’s Thesis?
    • Any algorithm can be written as a C++ program
    • Any problem which cannot be solved by a C++ program cannot be solved by any algorithm.
  • Importance?
    • The definition of REC is robust.
    • We could use other models of computation
      • Turing machines, Java programs, Lisp Programs,...
languages

REC

Languages

Question: Is REC a proper subset of the set of all languages/problems?

summary
Summary
  • Solving problems
    • Subroutine theme
  • REC
    • The class of solvable problems/languages
    • Church’s Thesis
      • Specific model of computation is not important
    • Question: Are all problems solvable?