Skip to content
Related Articles
Open in App
Not now

Related Articles

GATE | GATE-CS-2007 | Question 79

Improve Article
Save Article
Like Article
  • Last Updated : 14 Sep, 2021
Improve Article
Save Article
Like Article

For the correct answer strings to above question, how many derivation trees are there?

(A)

1

(B)

2

(C)

3

(D)

4


Answer: (B)

Explanation:

When it asks about the no of derivations tree, we should consider either left most derivation(LMD) or right most derivations(RMD), but not both. Here two left most derivations are possible for the correct string of the previous question \”aabbab\” from the given grammar. LMD-1 S -> aB [Using S –> aB] -> aaBB [Using B –> aBB] -> aabB [Using B –> b] -> aabbS [Using B –> bS] -> aabbaB [Using S –> aB] -> aabbab [Using B –> b] LMD-2 S -> aB [Using S –> aB] -> aaBB [Using B –> aBB] -> aabSB [Using B –> bS] -> aabbAB [Using S –> bA] -> aabbaB [Using A –> a] -> aabbab [Using B –> b] The Derivation tress are shown below : \"derivationTree\" 


Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!