Solution recursion based implementation d f t t b t a

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: are directional. Rerun depthfirst search in the directed graph below and label the edges accordingly. Solution: Recursion-based implementation: D F T T B T A T F T C B T C T E G H C Stack-based implementation: D T T C B T A T F T B T F C E C G T H 6.006 Quiz 2 Solutions Name 7 (e) [6 points] Suppose each passage in the maze causes a different amount of damage to you in game. You change the graph to use weights to represent the damage caused by each edge. You then use Dijkstra’s algorithm to find the path from A to H with the lowest possible damage. Write down the order in which vertices get removed from the priority queue when running Dijkstra’s algorithm. D 2 1 B 1 A Solution: 2 3 F 3 1 3 4 C A, B, D, C, F, E, G, H E 1 G 1 H 6.006 Quiz 2 Solutions Name 8 Problem 4. Malfunctioning Calculator [25 points] (5 parts) Former 6.006 student Mallory Funke is at a math competition, but her calculator isn’t working. It seems to work fine for whole numbers, but the numbers after the decimal point always seem to be t...
View Full Document

This document was uploaded on 03/17/2014 for the course ELECTRICAL 6.006 at MIT.

Ask a homework question - tutors are online