Created
October 29, 2020 09:24
-
-
Save Arrlindii/74efc72994073e2265e788086bf472ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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