Machine-translated by Google. Questions are authored in English.
Top

Discussion

Optimal instruction selection over a directed acyclic graph rather than a tree is

  • A.solved by the same dynamic programming algorithm unchanged
  • B.impossible because the graph contains cycles by definition
  • C.unnecessary because graphs never arise in real programs
  • D.computationally hard, so heuristics are used in practice

Answer: D

Correct answer: computationally hard, so heuristics are used in practice

A tree can be tiled optimally in linear time because each subtree has one parent and can be solved independently. A directed acyclic graph has shared subexpressions with several parents, so the choices interact and the problem becomes NP-hard - which is why the graph is usually split into trees and each tiled separately.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.