This preview shows page 1. Sign up to view the full content.
Unformatted text preview: .
(a) [4 points] Suppose that you want to ﬁnd a path from A to H . If you use breadth-ﬁrst
search, write down the resulting path as a sequence of vertices.
Solution: A, B, D, F, H ·
Scoring: For Problem 3(a), 3(b), and 3(e), we computed the score as M AXPNL ,Ns ) ,
where P is the total points of the problem, L is the length of the longest common
subsequence between our solution and the student’s answer, Na is the length of the
student’s answer, and Ns is the length of our solution. (b) [4 points] If you use depth-ﬁrst search to ﬁnd a path from A to H , write down the
resulting path as a sequence of vertices.
Solution: A, B, C, D, E, G, F, H if you use recursion, or A, C, D, F, H if you use
stack-based implemention. Essentially, the recursion-based implementation will visit
the neighbors in alphabetical order, while the stack-based implementation will visit
the neighbors in reverse alphabetical order. 6.006 Quiz 2 Solutions Name 5 (c) [6 points] To determine whether the maze has cycles or multiple paths to the...
View Full Document
This document was uploaded on 03/17/2014 for the course ELECTRICAL 6.006 at MIT.
- Fall '11