Pearson Interview Question

Write the code of BFS.