csci3255 HW 7

csci3255 HW 7 - 7.1/3a;4c,h;5 7.2/5 7.3/1,2 3 Construct...

This preview shows pages 1–2. Sign up to view the full content.

7.1/3a;4c,h;5 7.2/5 7.3/1,2 3. Construct npda’s that accept the following regular languages: a) L 1 = L ( aaa*b ) A npda that accepts a regular language doesn’t need a stack because the language can be handled by a finite automaton, so we create a npda that simply doesn’t care about the stack. 4. Construct npda’s that accept the following languages on = { a , b , c }. c) L = { a n b m c n + m : n 0 , m 0} Here we need the stack. We need to do two things: make sure the symbols come in the correct order and make sure the number of c ’s is correct. The order is taken care of by the transitions from state to state. The number of c ’s is taken care of by pushing a symbol for each a or b and popping for each c and requiring that the stack winds up with only the start symbol. h) L = { n a ( w ) = 2 n b ( w )} In this case we don’t care about the order. We just need to make sure that the number of a ’s is twice the number of b ’s. This is actually tricky. The idea is to push two symbols for each b and pop one symbol for each a . Conversely, we could push one symbol for each a and pop two symbols for each b . The problem is best understood by considering aab , baa , and aba . It all depends on what the first symbol is.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/07/2010 for the course COMPUTER S 138 taught by Professor Icamarra during the Spring '10 term at UCLA.

Page1 / 3

csci3255 HW 7 - 7.1/3a;4c,h;5 7.2/5 7.3/1,2 3 Construct...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online