Skip to content

Instantly share code, notes, and snippets.

@Arrlindii
Last active October 29, 2020 12:50
Show Gist options
  • Save Arrlindii/a3b749f77e58e70104a019e2746c06c6 to your computer and use it in GitHub Desktop.
Save Arrlindii/a3b749f77e58e70104a019e2746c06c6 to your computer and use it in GitHub Desktop.
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