Computer Science EngineeringHardISRO SC

Build the DAG for ((((c + a) + (b - a)) * ((a * b) + (b + a))) + (((a * b) + (b + a)) + ((a * b) + (b + a)))) using value numbering, treating + and * as commutative (so a+b and b+a share a node) and - as non-commutative. The number of operator (interior) nodes in the DAG is

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

Correct answer: B. 9

Assign a value number to each (op, operand numbers) key; duplicates collapse. 9 distinct operator nodes (12 nodes in total with leaves).

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

Exams that ask this topic