Different implementations for Ucs and AStar