Breadth first search#C.2B.2B implementation