ISRO | ISRO CS 2014 | Question 5
What is the number of steps required to derive the string ((() ()) ())
S → SS
S → (S)
S → ε
(A) 10
(B) 15
(C) 12
(D) 16
Answer: (A)
Explanation: To generate ((() ()) ()) , following steps are needed:
1) S → (S)
2) S → (SS)
3) S → ((S)S)
4) S → ((SS)S)
5) S → (((S)S))S)
6) S → (((S)(S))S)
7) S → (((S)(S))(S)) [S → ε]
8) S → ((()(S))S) [S → ε]
9) S → ((()())S) [S → ε]
10) S → ((()()))
Option (A) is correct.
Quiz of this Question
Last Updated :
11 May, 2018
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...