Part 2: Breadth-First Search — To check out Depth-First Search, check out part 1. Breadth-First Search (BFS) Unlike DFS, which goes deep in a certain direction first before considering another direction, BFS will analyze the next node in each possible direction first and then repeat the process for the next node in each direction. So instead of working…