next up previous
Next: About this document

Sergio A. Alvarez web: tex2html_wrap_inline53 alvarez/
Department of Computer Science e-mail:
Worcester Polytechnic Institute phone: (508) 831-5118
Worcester, MA 01609, USA fax: (508) 831-5776

CS 3133, A Term 1998
Final Exam Practice Problems

(also see the practice problems for the midterm exam)

  1. For each of the following pairs of languages tex2html_wrap_inline55 over the alphabet tex2html_wrap_inline57 , determine whether tex2html_wrap_inline59 or tex2html_wrap_inline61 . If tex2html_wrap_inline59 , give a regular expression for the languages. If tex2html_wrap_inline61 , give a string w that belongs to one of the two languages but not the other.
    1. tex2html_wrap_inline69 all strings not having the substring tex2html_wrap_inline71 .
    2. tex2html_wrap_inline73 all strings that contain twice as many 1's as 0's tex2html_wrap_inline79 , tex2html_wrap_inline81 . Note that tex2html_wrap_inline83 contains the empty string.
  2. Let L be the language of all strings w over the alphabet tex2html_wrap_inline89 such that tex2html_wrap_inline91 , where tex2html_wrap_inline93 denotes the number of times that the symbol x appears in w. For example, the string abaca is in L but aabc is not.
    1. Design an extended PDA (multiple pops and pushes allowed in a single transition) that accepts L by final state and empty stack.
    2. Convert your extended PDA from part (a) into a standard PDA (only a single pop/push allowed in each transition).
    3. Is L a regular language? Explain.
    4. Is L a context-free language? Explain.
    1. Find the language L accepted by the PDA P that has state set tex2html_wrap_inline115 , accepting state set tex2html_wrap_inline117 , input alphabet tex2html_wrap_inline119 , stack alphabet tex2html_wrap_inline121 , and transition function tex2html_wrap_inline123 defined by


    2. Design a Turing machine that accepts the language L from part (a).
    3. Calculate the time complexity of the machine M from part (b).

  3. Show that each of the following problems belongs to the class NP by finding a deterministic polynomial time verifier. In each case, explain what the input to the verifier is, how the verifier operates, and why it runs in polynomial time.
    1. The Hamiltonian path problem: Given a graph G, determine (yes/no answer) if there is a path in G that visits each vertex of G exactly once.
    2. The graph coloring problem: Given a graph G and a natural number k, determine (yes/no answer) if there is a coloring of the vertices of G using k colors such that no edge of G connects two vertices of the same color. Assume that there is at most one edge connecting any given pair of vertices.

next up previous
Next: About this document

Sergio A. Alvarez
Mon Oct 12 13:50:02 EDT 1998