Google News
logo
Artificial Intelligence - Interview Questions
What is a uniform cost search algorithm?
Uniform-cost search is an uninformed search algorithm that uses the lowest cumulative cost to find a path from the source to the destination. Nodes are expanded, starting from the root, according to the minimum cumulative cost. The uniform-cost search is then implemented using a Priority Queue.
 
Uniform Cost Search Algorithm :
 
* Insert the root node into the priority queue
 
* Repeat while the queue is not empty :
   a) Remove the element with the highest priority
   b) If the removed node is the destination, print total cost and stop the algorithm
   c) Else, enqueue all the children of the current node to the priority queue, with their cumulative cost from the root as priority
Advertisement