Added bfs algo for trees