Algorithm Breadth First Search.