Search Algorithms in AI (original) (raw)

Last Updated : 9 Jun, 2026

Search algorithms in AI are techniques used to find solutions by exploring possible paths or states in a problem space. They help intelligent systems make decisions, solve problems and reach goals efficiently in applications such as navigation, robotics, game playing and pathfinding.

Types of Search Algorithms

There are mainly 2 types of search algorithms i.e Uninformed Search Algorithms and Informed Search Algorithms.

Search-Algorithms

Search Algorithms in AI

Uninformed Search Algorithms

Uninformed search, also known as blind search algorithms, explore the search space without using any domain specific knowledge about the goal state. They rely only on the structure of the problem such as node depth or path cost to decide which node to explore next.

1. Depth First Search (DFS)

Depth First Search explores nodes by moving as deep as possible along a branch before backtracking. It uses a stack or recursion to keep track of visited nodes.

**Example: DFS traversal from node S to G.

Breadth First Search explores all possible paths level by level starting from the root node. It visits all neighboring nodes before moving to the next depth level.

**Example: BFS traversal from node S to G

Uniform Cost Search expands the node with the lowest cumulative path cost from the start node. It is useful when different paths have different traversal costs.

**Example: UCS traversal from node S to G

Informed Search Algorithms

Informed search uses domain knowledge in the form of heuristics to make smarter decisions during the search process. These heuristics estimate how close a state is to the goal guiding the search more efficiently.

Greedy Search selects the node that appears closest to the goal based on the heuristic value h(n). It focuses only on the estimated distance to the goal and ignores the path cost already travelled.

**Example: We find the path from S to G using greedy search, the heuristic values h of each node below the name of the node.

A* Tree Search uses an evaluation function to evaluate and prioritize nodes during the search process:

f(n) = g(n) + h(n)

Where:

This approach explores paths with the lowest combined cost but treats the search space as a tree, meaning repeated states are not tracked.

**Example: Find the path to reach from S to G using A* search.

9

Starting from S the algorithm computes g(x) + h(x) for all nodes in the fringe at each step choosing the node with the lowest sum. The entire work is shown in the table below.

Path h(x) g(x) f(x)
S 7 0 7
S -> A 9 3 12
S -> D ✔ 5 2 7
S -> D -> B ✔ 4 2 + 1 = 3 7
S -> D -> E 3 2 + 4 = 6 9
S -> D -> B -> C ✔ 2 3 + 2 = 5 7
S -> D -> B -> E ✔ 3 3 + 1 = 4 7
S -> D -> B -> C -> G 0 5 + 4 = 9 9
**S -> D -> B -> E -> G ✔ 0 4 + 3 = 7 7

**Path: S → D → B → E → G and Cost: 7

A* Graph Search improves upon A* Tree Search by keeping track of already visited nodes using a closed list. This avoids revisiting nodes and reduces redundant exploration.

**Example: Use graph searches to find paths from S to G in the following graph.

Comparison of Different Search Algorithms

**Algorithm **Time Complexity **Space Complexity **Complete **Optimal
Breadth First Search O(b^d) O(b^d) Yes Yes (if step cost is same)
**Depth First Search O(b^d) O(d) No No
**Uniform Cost Search O(b^{1 + \frac{C^*}{\epsilon}}) O(b^{1 + \frac{C^*}{\epsilon}}) Yes Yes
**Greedy Search O(b^m) O(b^m) No No
**A* Tree Search O(b^d) O(b^d) Yes (if h is admissible) Yes (if h is admissible)
**A* Graph Search O(b^d) O(b^d) Yes (if h is admissible) Yes (if h is admissible)

Advantages

Limitations

  1. Artificial Intelligence (AI) Algorithms
  2. Informed Search Algorithms in Artificial Intelligence
  3. Difference between Informed and Uninformed Search in AI
  4. Uninformed Search Algorithms in AI