midterm-w07-solution

# midterm-w07-solution - Winter 2007 Midterm Solutions...

This preview shows pages 1–2. Sign up to view the full content.

Winter 2007 Midterm Solutions Problem 1: True/False (a) (3 points) If a node n 1 dominates a node n 2 , then n 1 is always visited before n 2 in a depth-first search. TRUE. By the definition of domination, all paths that lead to n 2 go through n 1 first. So, a depth-first search must reach n 1 first. - OR - FALSE. A post-order depth-first search visits all children of a node before visiting the node itself. By the definition of domination, n 2 must be visited first, since it is a child. (b) (3 points) If a node n 1 dominates a node n 2 , n 1 is always visited before n 2 in a reverse post ordering. TRUE. Justification is essentially identical to the "False" answer for 1(a) -- if a post- ordering must list n 2 first, then a reverse post-ordering must list n 1 first. (c) (3 points) Given a monotone data flow framework, had all the interior points of the data flow solver been initialized with the "bottom" of the semi-lattice, the answer at every point in every program would have been "bottom." FALSE. Even though any element met with bottom is itself bottom, this makes no assumption about the results of the transfer function. Suppose the transfer function returns a single constant value (not bottom). This is definitely monotone (no matter the values of x and y, f(x) f(y)), and the values once the solution stabilizes will definitely not

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

midterm-w07-solution - Winter 2007 Midterm Solutions...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online