Discussion
The expression a + b + a + b is represented as a directed acyclic graph with sharing. How many distinct interior nodes does it have?
Answer: B
In a directed acyclic graph, identical subexpressions are built once and shared. Here \( a+b \) occurs twice but becomes a single node, and the outer addition that combines the two references is a second: \[ \text{interior nodes} = 1 \ (a+b) + 1 \ (\text{outer} +) = 2 \] A plain syntax tree, which cannot share, would carry three interior nodes for the same expression.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development