
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
Best First Search (Informed Search)
Best first search is a traversal technique that decides which node is to be visited next by checking which node is the most promising one and then check it. For this it uses an evaluation function to decide the traversal.
This best first search technique of tree traversal comes under the category of heuristic search or informed search technique.
The cost of nodes is stored in a priority queue. This makes implementation of best-first search is same as that of breadth First search. We will use the priorityqueue just like we use a queue for BFS.
Algorithm for implementing Best First Search
Step 1 : Create a priorityQueue pqueue. Step 2 : insert ‘start’ in pqueue : pqueue.insert(start) Step 3 : delete all elements of pqueue one by one. Step 3.1 : if, the element is goal . Exit. Step 3.2 : else, traverse neighbours and mark the node examined. Step 4 : End.
This algorithm will traverse the shortest path first in the queue. In worst case scenario the algorithm takes O(n*logn) time.
- Related Articles
- Difference Between Informed and Uninformed Search
- Depth First Search
- Breadth First Search
- Which is the best Search Engine?
- How to Search for Best YouTube Hashtags
- Breadth-first search traversal in Javascript
- Depth-first search traversal in Javascript
- Breadth-first Search is a special case of Uniform-cost search in ML
- Breadth First Search (BFS) for a Graph
- Depth First Search (DFS) for a Graph
- Breadth First Search on Matrix in C++
- Breadth First Search on Matrix in Python
- What Are The Best Search Engine Marketing (SEM) Tools?
- Depth First Search or DFS for a Graph
- Breadth First Search or BFS for a Graph

Advertisements