The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+4 votes

to derive **a^b*c **

first we use E->E^E

then E->E*E

then E->id

so it print first all id , then * after this ^ will be print.

+3 votes

To derive **a^b*c**, one can use either of the following two derivations:-

Derivation 1:

E ==> E ^ E

==> E ^ E * E

==> a ^ b * c

Derivation 2:

E ==> E * E

==> E ^ E * E

==> a ^ b * c

Draw a parse tree for both the derivations and do a postorder traversal of the same. The outputs would be **a b ^ c*** and **a b c * ^**. Only one of these is mentioned in the option and so that would be the answer. :)

- All categories
- General Aptitude 1.1k
- Engineering Mathematics 4k
- Digital Logic 1.7k
- Programming & DS 3k
- Algorithms 2.6k
- Theory of Computation 3.2k
- Compiler Design 1.2k
- Databases 2.4k
- CO & Architecture 2.1k
- Computer Networks 2.4k
- Non GATE 819
- Others 1.1k
- Admissions 244
- Exam Queries 419
- Tier 1 Placement Questions 16
- Job Queries 39
- Projects 4

29,156 questions

36,980 answers

92,147 comments

34,822 users