Open In App

Difference between Best-First Search and A* Search?

Last Updated : 06 Sep, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

Best-First Search:

Best-First search is a searching algorithm used to find the shortest path which uses distance as a heuristic. The distance between the starting node and the goal node is taken as heuristics. It defines the evaluation function for each node n in the graph as f(n) = h(n) where h(n) is heuristics function.

A*Search:  

A*search is a searching algorithm used to find the shortest path which calculates the cost of all its neighboring nodes and selects the minimum cost node. It defines the evaluation function f(n) = g(n) + h(n) where, h(n) is heuristics function and g(n) is the past knowledge acquired while searching.

Difference Between Best-first search and A*search:

The best-first search and A* search algorithm both define the evaluation function for each node n of the graph. This evaluation function is denoted by f(n). This evaluation function determines which node to be expanded first while searching. Both search algorithms mainly differ in their evaluation function. Here, f(n) is the evaluation function, g(n) is the past knowledge acquired while searching, and h(n) is the heuristics function. 

The difference between the best-fit and A* search algorithms is represented by the following table.

S

Parameters    

Best-First Search

      A* Search     

  1Evaluation FunctionThe evaluation function for best-first search is f(n) = h(n).The evaluation function for A* search is f(n) = h(n) + g(n).
  2Past KnowledgeThis search algorithm does not involve past knowledge.This search algorithm involves past knowledge.
  3CompletenessBest-first search is not complete.A* search is complete.
  4OptimalBest-first search is not optimal as the path found may not be optimal.A* search is optimal as the path found is always optimal.
  5Time and Space Complexity

Its time complexity is O(bm) and space complexity can be polynomial.

where b is the branching and m is the maximum depth of the search tree 

Its time complexity is O(bm) and space complexity is also O(bm).

where b is the branching and m is the maximum depth of the search tree 

  6Memory It requires less memory.It requires more memory.
  7Type of nodes keptIt keeps all the fringe or border nodes in the memory while searching.It keeps all the nodes in the memory while searching.

Next Article
Article Tags :
Practice Tags :

Similar Reads