Last active
October 29, 2020 12:50
-
-
Save Arrlindii/a3b749f77e58e70104a019e2746c06c6 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 bfs(start: String, target: String) { | |
var queue = [start]; | |
while let node = queue.popLast() { | |
let children = adjacencyList[node]!; | |
for movie in children { | |
if (movie == target) { | |
print("TARGET MOVIE FOUND-" + target) | |
} | |
queue.append(movie); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment