Sie sind auf Seite 1von 7

Theory of Computation - GATE Bits in PDF

Theory of Computation is an important topic from the point of view of competitive


exams testing your strength in Computer Science. These include exams like GATE,
DRDO, BARC etc. In this free GATE Notes & Study Material, you can find the
techniques to approach the topic. You can also download these GATE Bits in PDF.

Guidelines to Obtain Regular Expression from an FA

i. It doesn’t matter whether FA is deterministic or non – deterministic.


ii. Axe unreachable and trap states if any.

iii.
a. When there is no final state then machine accepts the empty language
and hence regular expression is Φ.
b. When there is a single final state then we take the longest path to it
from the start state.

∴ 𝑟 = 𝑟𝐴 = 𝑟𝑆𝐴 . (𝑎 + 𝑏 + 𝑐)
rSA : Longest path to A from S
c. When there are more than one final states, for example two, let’s say A
and B

1|Page
𝑟 = 𝑟𝐴 + 𝑟𝐵

If A and B are in series B can be written in terms of A

If A and B are in series B can be written in terms of A


rA = b ∗ ab ∗
rB = rA . ab ∗ b(a + b) ∗

If they are not in series then we write them individually

Here, r = rA + rB = (p + q + r) ∗ +(x + y + z) ∗

Examples based on Theory of Computation

E.g. 1.

2|Page
∴ 𝑟 = 0 ∗ 1(1 + 01 ∗ 0) ∗

E.g. 2

Here, rA = 0 ∗ 1(0 + 11 ∗ 0) ∗
𝑟𝐵 = 𝑟𝐴 . 1.1 ∗
𝑟 = 𝑟𝐴 + 𝑟𝐵 = 0 ∗ 1(0 + 11 ∗ 0) ∗ [𝜖 + 1.1 ∗]
= 0 ∗ 1(0 + 11 ∗ 0) ∗ 1 ∗
This is in fact equal to 0 ∗ 1(0 + 1) ∗
∵ (1 ∗ 0) ∗ 1 ∗≡ (0 + 1) ∗

E.g. 3.

∴ 𝑟. 𝑒. = 𝑎(𝑏 + 𝑎𝑏 ∗ 𝑎) ∗ 𝑏

3|Page
E.g. 4.

∴ 𝑟. 𝑒. = 𝑎(𝑏𝑎 + 𝑏 + 𝑎𝑏 ∗ 𝑎) ∗

E.g. 5.

If we take the loop on left side


𝑟1 = (0 + 11 ∗ 0) ∗ 11 ∗
If we take the loop on right side
𝑟2 = 0 ∗ 1(00 ∗ 1 + 1) ∗
∴ 𝑟1 = 𝑟2
(0 + 11 ∗ 0) ∗ 11 ∗= 0 ∗ 1(00 ∗ 1 + 1) ∗

E.g. 6.

4|Page
𝑟𝐴 = 𝑎(𝑎 + 𝑏𝑏 ∗ 𝑎) ∗ +𝑏(𝑏 + 𝑎𝑎 ∗ 𝑏) ∗ 𝑎𝑎 ∗
𝑟𝐵 = 𝑏(𝑏 + 𝑎𝑎 ∗ 𝑏) ∗ +𝑎(𝑎 + 𝑏𝑏 ∗ 𝑎) ∗ 𝑏𝑏 ∗
∴ 𝑟 = 𝑟𝐴 + 𝑟𝐵

Now Try It Yourself

Q1. Obtain the regular expression

1. (a + b(b + ab)∗ aa)∗


2. (a∗ + b∗ (b + ab)∗ a) ∗
3. Both A and B
4. Neither A nor B

Q2. Which of the following alteration into a finite state automate will change the
language accepted by it and hence the obtained regular expression?
1. Adding a trap state without changing any other transition
2. Adding a non reachable state
3. Changing its determinism
4. Changing the final state

Q3. Find the regular expression for the following

1. (aa + bb) (a + b) ∗
2. (a + b) ∗ (aa + bb)
3. Both A and B

5|Page
4. None of the above

Q4. Obtain the regular expression

1. (aca + ba) ∗ b
2. (aca + ba) ∗ (b + ac)
3. ac (ab + aac) ∗ + b (ab + aac) ∗
4. Both B and C

Answer Key & Solutions

Ans 1: Option 1 - (a + b(b + ab)∗ aa)∗


Solution:
𝑟. 𝑒. = (𝑎 + 𝑏(𝑏 + 𝑎𝑏) ∗ 𝑎𝑎) ∗

Ans 2: Option 4 - Changing the final state


Ans 3: Option 2
Solution: We can, observe that it’s the DFA
Accepting the strings with last two bits same
Ans 4: Option 4
Solution: If we take both the loops at S we get B.
If we get both the loops at B we get C.

6|Page
Additional Practice Problems

Q1. Using NFA with null moves prove or disprove the following Identity
(𝑝𝑞 + 𝑝) ∗ 𝑝 ≡ 𝑝(𝑝 + 𝑞𝑝) ∗
Q2. Obtain the regular expression for the following machine

Liked this article on Theory of Computation? Read more:

NLC 2017 Recruitment through GATE for ETs >> NLC Recruitment Notification 2017

PGCIL 2017 Recruitment through GATE for ETs >> PGCIL Recruitment Notification 2017

IOCL 2017 Recruitment through GATE for Engineers >> IOCL Recruitment Notification 2017

BSNL JTO Exam Scrapped - Recruitment thro’ GATE >> BSNL JTO Recruitment Notice 2017

SSC JE 2016 Syllabus, Pattern, Vacancies & More! >> SSC JE Recruitment Notice 2016

How to Get a Free Test Series of Your Choice Daily! >> Free Tests for GATE 2017, SSC JE

Complete & Detailed Official GATE 2017 Syllabus >> Complete GATE CS Syllabus 2017

Best Books to help you clear GATE 2017 Engg. Maths >> Recommended Books for Engg Maths

Modules & Revision Tests for Engg. Mathematics >> Linear Algebra Revision Test 1

7|Page

Das könnte Ihnen auch gefallen