Skip to content

Instantly share code, notes, and snippets.

@Arrlindii
Created October 29, 2020 09:24
Show Gist options
  • Save Arrlindii/74efc72994073e2265e788086bf472ea to your computer and use it in GitHub Desktop.
Save Arrlindii/74efc72994073e2265e788086bf472ea to your computer and use it in GitHub Desktop.
func dfs(start: String, target: String) -> Bool{
visitedNodes.append(start)
print(start)
let directNodes = adjacencyList[start]!
for node in directNodes {
if node == target {
print("found the target movie: \(target)")
return true;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment