Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

ECE1026 Algorithms and Data Structures

Tutorial 3: Finite State Automata and Turing Machine

1. (c) Draw a finite state diagram that will accept these regular expressions:
a) a*b
b) 1(2+|3+)4*
c) ((x|ε)y)*

2. Given FSA in Figure 2.1,

E A

1 2 3 6
R A ε a
a a

P
4 5
a C a

Figure 2.1

Answer the following:

a) Write the Regular Expression (RE)


b) State the Q, F and ∑
c) Below are accepted words except:
i) RA iii) RELP v) RELPC
ii) REA iv) RLPCP

1
3. Given FSA in Figure 3.1, answer the following:

1 2 3
H V
a a

T
4 T

Figure 3.2

Answer the following:

a) Write the Regular Expression (RE)


b) State the Q, F and ∑
c) Below are accepted words except:
i) HDDV iii) HT v) HDD
ii) HV iv) HDDTT

4. Given NFSA in Figure 4.1, answer the following:

B
0 a 3

A 2 D
1
a

1 ε
C

Figure 4.3

Answer the following:

a) Write the Regular Expression (RE)


b) State the Q, F, ∑, and q0
c) Below are accepted words except:

2
i) 03 iii) 111 v) 2111
ii) 22203 iv) 2220

5. Given Turing Machine in Figure 5.1, answer the following:

(B, A, →)

1 2 3
(A, C, →) a (C, C, →) a

(A, B, →)

Figure 5.4

Answer the following:

a) What is the output on the tape at the end of the execution?


b) Draw where the read/write head is pointing to on the tape at the end of the execution

A A B C F

Read/Write Head

You might also like