breadth-first algorithm | ScratchStats