Computer Science EngineeringVery hard

How many nodes does the DAG for the expression a + a*(b-c) + (b-c)*d contain (common subexpressions shared)?

  1. A. 8
  2. B. 9
  3. C. 10
  4. D. 11

Correct answer: B. 9

There are 4 leaves (a,b,c,d) and 5 operator nodes: b-c, a*(b-c), the first +, (b-c)*d and the final +.

More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions

Exams that ask this topic