The uniform cost search performs sorting in increasing the cost of the path to a node. It expands the least cost node. It is identical to BFS if each iteration has the same cost. It investigates ways in the expanding order of cost.
For an artificial intelligence interview question about the uniform cost search algorithm, the correct answer would be:
“The Uniform Cost Search (UCS) algorithm is a variant of Dijkstra’s algorithm used for finding the shortest path in a weighted graph. Unlike breadth-first search, which explores all neighbors regardless of their costs, UCS expands nodes in order of their total path cost from the start node. This means that UCS explores the least-costly path first and continues expanding nodes with increasing costs until it reaches the goal node. UCS guarantees to find the optimal path when all edge costs are non-negative.”