Docsity

Pumping Lemma -Computability and Complexity - Exams, Exams of Advanced Algorithms

Toggle sidebar
bg1
Quiz 1
CS 172: Computability and Complexity, Fall 95
11am-12:30pm, 25 October
Notes: There are three questions on this quiz. Please answer each question in the space below it, using the
back of the sheet to continue your answer if necessary. Please write clear, concise answers. If you are having
problems with part of a question, leave it and try the next one.
_________________________________________________________________________________
1. (a) Which of the following languages are regular? If the language is regular, provide a finite automaton or a
regular expression for it. If not, give a proof using the pumping lemma.
The set of all 0-1 strings that contain either the substring 000 or the substring 111 (or both).i. The language {0i1j2k : i = j or j = k}.ii. The set of all 0-1 strings of the form 0i1j, where i is odd and j is even.iii.
(b) Give a context free grammar for each of the language in part (a).
_________________________________________________________________________________
2. Which of the following statements are true? If the statement is true, give a short proof. If it is false, give a
simple counterexample. You may assume without proof any result that was proven in class or on a homework,
provided you state it clearly.
If L is regular and L is a subset of L, then L is regular.a. If L1, L2, L3  are regular, then the language Ub.
∞i=1 Li is also regular.
If L1 and L2 are both context free, then L1 ∩ L2 is context free.• If L1is regular and L2 is context free, then L1 ∩ L2 is context free.• If L1 and L2 are both recursively enumerable (r.e.), then L1 ∪ L2 is also r.e.•
Note: Remember that a Turing machine for an r.e. language may reject by computing forever.
_________________________________________________________________________________
3. Recall from class that limiting the number of registers of a RAM to some fixed constant does not affect its
computational power, since any language accepted by a RAM is also accepted by a RAM with only three
registers. This problem investigates what happens when we limit the size of the registers, i.e., we allow them
to contain only integers in some fixed range [ -N,,N ], where N is a constant.
Consider first a RAM in which both the number and the size of the registers are limited. Can any
language that is accepted by a standard RAM also be accepted by such a RAM? Justify your answer
carefully: wooly reasoning will receive little credit.
a.
Now suppose we allow the RAM to have infinitely many registers, as in the standard model, and we
limit only the size of the registers. Can any language that is accepted by a standard RAM also be
accepted by such a RAM? Justify your answer carefully: woolly reasoning will receive little credit.
b.
Quiz 1
1
pf2

Partial preview of the text

Download Pumping Lemma -Computability and Complexity - Exams and more Exams Advanced Algorithms in PDF only on Docsity!

Quiz 1

CS 172: Computability and Complexity, Fall ’ 95

11am-12:30pm, 25 October

Notes: There are three questions on this quiz. Please answer each question in the space below it, using the back of the sheet to continue your answer if necessary. Please write clear, concise answers. If you are having problems with part of a question, leave it and try the next one.


  1. (a) Which of the following languages are regular? If the language is regular, provide a finite automaton or a regular expression for it. If not, give a proof using the pumping lemma.

i.The set of all 0-1 strings that contain either the substring 000 or the substring 111 (or both). ii.The language {0i 1 j 2 k^ : i = j or j = k}. iii.The set of all 0-1 strings of the form 0i 1 j, where i is odd and j is even.

(b) Give a context free grammar for each of the language in part (a).


  1. Which of the following statements are true? If the statement is true, give a short proof. If it is false, give a simple counterexample. You may assume without proof any result that was proven in class or on a homework, provided you state it clearly.

a.If L is regular and L’ is a subset of L, then L’ is regular. b.If L 1 , L 2 , L 3 are regular, then the language U

∞ i=1 Li is also regular.

  • If L 1 and L 2 are both context free, then L 1 ∩L 2 is context free.
  • If L 1 is regular and L 2 is context free, then L 1 ∩L 2 is context free.
  • If L 1 and L 2 are both recursively enumerable (r.e.), then L 1 ∪L 2 is also r.e.

Note: Remember that a Turing machine for an r.e. language may reject by computing forever.


  1. Recall from class that limiting the number of registers of a RAM to some fixed constant does not affect its computational power, since any language accepted by a RAM is also accepted by a RAM with only three registers. This problem investigates what happens when we limit the size of the registers, i.e., we allow them to contain only integers in some fixed range [ -N, ,N ], where N is a constant.

Consider first a RAM in which both the number and the size of the registers are limited. Can any language that is accepted by a standard RAM also be accepted by such a RAM? Justify your answer carefully: wooly reasoning will receive little credit.

a.

Now suppose we allow the RAM to have infinitely many registers, as in the standard model, and we limit only the size of the registers. Can any language that is accepted by a standard RAM also be accepted by such a RAM? Justify your answer carefully: woolly reasoning will receive little credit.

b.

Quiz 1

_________________________________________________________________________________

Quiz 1