1.
Draw the graph corresponding to the following adjacency matrix.

From | To | Cost |
---|---|---|
1 | 2 | 10 |
1 | 3 | 15 |
1 | 6 | 5 |
2 | 3 | 7 |
3 | 4 | 7 |
3 | 6 | 10 |
4 | 5 | 7 |
6 | 4 | 5 |
5 | 6 | 13 |
build_graph
function?for
loops.for
loops would dictate that this is in the realm of for
loops intertwined, it is not in constant time.ArrayList<ArrayList<T>>
(where T is your data type). The main ArrayList contains one ArrayList per forest, with each forest containing the keys for that forest.