added the classic iterative BFS algorithm