In A * algorithm we choose the node with minimum f ( f = g+h) where g is the distance from start to current node and h is the distance from end to current node.

I implemented A* search in a grid with some obstacles that can traverse up , down ,left , right and at the same time also implemented breadth first search .

I judged the performance of both by finding number of nodes visited by both algorithms and it were same ,no difference was seen.

Now even after applying heuristic in A* search and picking the node with the least f from open list , A* was not efficient as the number of visited nodes was same in both case .

But when i picked node from open list on the basis of minimum **h** i could see A* performance increased .

Now if **h** is only sufficient then why **f** is needed in A* search?

pls someone explain.