Add BFS implementation, pre-order.