{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

MIT1_204S10_assn3

# MIT1_204S10_assn3 - 1.204 Computer Algorithms in Systems...

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

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

View Full Document
not only easily find all the arcs out of a node, but also to find all the arcs into a node. An example is: 0 2 1 3 4 If we read the arcs from input and sort by ‘from’ node, we get: From To Cost (Arc number) 0 1 4 3 0 0 2 5 2 1 0 3 9 4 2 1 2 2 2 3 3 4 7 1 4 3 1 3 7 5 The ‘from’ node repeats when out-degree > 1 We recast this structure as arrays H, To, Cost (and T): (Node) H (Arc) To Cost Index T (Node) 0 0 0 1 4 3 0 00 1 3 1 2 5 2 5 01 2 4 2 3 9 4 1 22 3 4 3 2 2 2 3 43 4 6 4 4 7 1 2 54 5 6 (sentinel) 5 1 37 4 6(sent) 5 In the example, we use an ‘index’ array to put the arcs in order of their destination. If we read down ‘index’, it says that the arcs must be accessed in the order 0, 5, 1, 3, 2, 4 to be sorted by ‘to’ node rather than ‘from’ node: There are no arcs into node 0 Arcs 0 and 5 go into node 1 Arcs 1 and 3 go into node 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

MIT1_204S10_assn3 - 1.204 Computer Algorithms in Systems...

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

View Full Document
Ask a homework question - tutors are online