CSCI1001 -- Introduction to Computer Science
Part II -- Robert Hochberg

Notes from class can be found here.

NP-Complete Problems
  1. The traveling salesman problem is an example of an NP-complete problem
  2. A problem is called NP-complete if:
  3. Other NP-Complete problems include:
  4. NP-Complete problems have the following two characteristics:

Question 6:  What is the least number of colors required to color the vertices in the graph below, so that vertices which are connected by an edge get different colors?
Question 7:  What is the least number of colors required to color the vertices in the graph below, so that vertices which are connected by an edge get different colors?
c1 c2
Deterministic Finite Automata (DFA's)
  1. Also called "Finite State Machines."DFA1
  2. A DFA consists of:
  3. These are "machines" which process an input string and move from state to state as they process the string.
  4. Question 1:  Build a DFA which accepts all strings.
  5. Question 2:  Build a DFA which accepts no strings.  (We've done these in class already...)
  6. A string is a sequence of symbols.
  7. A language is a set of strings, and the language of a DFA is the set of strings that the DFA accepts.
  8. Also, in the DFA above, computation on any string which starts with "00" will end in the lower-right state.
  9. Some more examples:
The language of the DFA to the right is:
{011, 0011, 1011, 00011, 01011, 10011, 11011, ...},
That is, the set of all strings which end in "011".
dfa2
The language of the DFA to the right is:
{0, 1, 01, 10, 010, 101, 0101, 1010, ...}.
That is, the set of all strings which have no two consecutive symbols the same
dfa3
This DFA accepts the language:
{0, 1, 00, 01, 10, 11, 000, 001, 010, 100, 101, 110, 111, 0000, 0001, ...},
That is, the set of all strings which do not contain "011" as a substring.
dfa6
This DFA accepts the language:
{0, 1, 000, 001, 010, 011, 100, 101, 110, 111, 00000, 00001, 00010, 00011, 00100, ...},
That is, the set of strings with an odd number of symbols.
dfa7
Question 3:  What is the language of the DFA shown to the right?
dfa4
Question 4:  What is the language of the DFA shown to the right?
dfa5

Loops and infinite languagesLoops
  1. All of the machines depicted in the table above have infinite languages. 
  2. The two machines shown to the right, however, do not have infinite languages.
  3. To show that a machine has an infinite language, you can show a list of strings with "..." at the end, implying that any reasonable reader could extend the shown sequence.
  4. You can also describe the language in words
  5. How can you tell whether a machine has a finite or infinite language?Grid automaton
Halting Problem
  1. This material can be found in your book, in the last chapter.
  2. It can also be found at www.wikipedia.org.  Search for "halting problem."
  3. The halting problem asks:  Does there exist a program Halt(program P, input I) which looks at program P, with input I, and asks whether program P will halt if its input is I.
  4. We proved that the program Halt cannot exit.  Because if it did exist, then we would be able to construct another program called "trouble" (name taken from Wikipedia's article) which works as follows:
  5. So the halting problem, to write a program which does what Halt, described above, should do, can never be solved by computers.
  6. This leads to a whole host of problems which computers will never be able to solve, such as
  7. Question 9:  What is the Halting problem
  8. Question 10:  Is it possible to write a computer program which reads another program as input and determines whether that program has an infinite loop or not?




ml>