Key to Homework - PowerPoint PPT Presentation

About This Presentation
Title:

Key to Homework

Description:

start. 0, 4, 8. 1, 5, 9. 2, 6. 3, 7. 2. 0,4,8. 2, 6 ... start. 4. ... start (X, Z0/Z0 ) Answer: See the attached notes in the figure for how the machine works. ... – PowerPoint PPT presentation

Number of Views:22
Avg rating:3.0/5.0
Slides: 6
Provided by: scie210
Learn more at: http://www.cs.rpi.edu
Category:
Tags: homework | key | start

less

Transcript and Presenter's Notes

Title: Key to Homework


1
Key to Homework 4 (Models of Computation,
Spring, 2001)
1. Construct a DFA which recognizes Pascals
unsigned integers that are divisible by 4, i.e.,
the following language L. L n
n ? 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, (n mod 4)
0 Hint Refer the example in the handout
page 55.
Answer
2
2. For the following NFA, (i) show the state
transition sequence tree (see an example on
handout page 65) when each of the following
strings is given as an input, and (ii) based on
the tree write your decision on whether the
string is accepted or not. (a)
aaabaa (b) aaabbaa (c) babbaa
Answer (a) String aaabaa is accepted.
Figure (a). State transition tree for aaabaa.
3
Answer (c) String babbaa is accepted
Figure (c) State transition tree for babbaa
4
3. What is the language accepted by the
following NFA?
Answer aaa ? a2i i gt 0
4. Construct an NFA which recognize the language
aaxaa x ?a, b, c with no more than 5
states.
a, b, c
5
5. Construct an NPDA (or DPDA if you can) which
recognizes the following language, and briefly
describe how your machine works.
L xyz x, y, z ? a, b, and y zR
Answer See the attached notes in the figure for
how the machine works. For notational
convenience, we use X, Y ? a, b.
Nondeterministically begin pushing y part.
Nondeterministically jump to popping state, where
y and z is compared.
(Y, X/YX )
( ?, Z0/Z0 )
q1
q3
(?, X/X )
(X, Z0/X Z0 )
If stack is empty, enter the accepting state.
q2
q0
start
(X, X/? )
(X, Z0/Z0 )
Compare y (in the stack) and z from the input. If
match, pop the stack.
Process x part of the language
Write a Comment
User Comments (0)
About PowerShow.com