CS 172 Fall 2003 Problem Set 5: Computability and Complexity, Assignments of Asian literature

Problem set 5 for cs 172 - computability and complexity, a university course offered in the fall of 2003. The problem set includes three programming problems related to pushdown automata (pda) and context-free grammars (cfg). Problem 1 asks for a pda and cfg for three given languages: palindromes (l1), a language of words with twice as many 0's as 1's (l3), and a regular expression language (l2). Problem 2 asks to construct a pda recognizing the intersection of the languages recognized by a given pda (a) and a dfa (b).

Typology: Assignments

Pre 2010

Uploaded on 09/07/2009

koofers-user-de5-1
koofers-user-de5-1 🇺🇸

9 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 172 Fall 2003 Problem Set #5
Computability and Complexity Due October 1, 2003
Problem 5.1. (10 points) For the following three languages Liover the alphabet {0,1}, give both
aPDA that recognizes Liand a CFG that generates Li.
L1={w:w=wR}. This is the set of palindromes.
L2={0n12n:n0}.
L3is the set of words that contain twice as many 1’s as 0’s.
Problem 5.2. (5 points) Show that the intersection of a context-free language and a regular
language is always context-free. That is, given a PDA Aand a DFA B, construct a PDA Cso that
L(C) = L(A)L(B).

Partial preview of the text

Download CS 172 Fall 2003 Problem Set 5: Computability and Complexity and more Assignments Asian literature in PDF only on Docsity!

CS 172 — Fall 2003 Problem Set # Computability and Complexity Due October 1, 2003

Problem 5.1. (10 points) For the following three languages Li over the alphabet { 0 , 1 }, give both a PDA that recognizes Li and a CFG that generates Li.

  • L 1 = {w : w = wR}. This is the set of palindromes.
  • L 2 = { 0 n 12 n^ : n ≥ 0 }.
  • L 3 is the set of words that contain twice as many 1 ’s as 0 ’s.

Problem 5.2. (5 points) Show that the intersection of a context-free language and a regular language is always context-free. That is, given a PDA A and a DFA B, construct a PDA C so that L(C) = L(A) ∩ L(B).