X443: Graphs - Depth First Traversal

Given is an adjacency matrix and a starting index.

Complete the depth first traversal method. Comments noted with //_________________ are lines that must be completed
java.util.Stack and java.util.ArrayList have been enabled.

Examples:

depthFirstTraversal({{0, 1, 0, 1}, {0, 0, 1, 0}, {0, 0, 0, 1}, {0, 1, 0, 0}},0) -> new java.util.ArrayList<Integer>(){{add(0);add(3);add(1);add(2);}}

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.