In this section we would examine four common search techniques in AI and their algorithms. We would consider the efficiency of each search technique in terms of how fast it arrives at a solution as well as how optimal the solution it. Then we would write a program to implement the algorithms in Java.The four of them are:
- Depth-First Search
- Breadth-First Search
- Hill-Climbing
- Least-Cost
- Binary Search
Let's begin with the first one.
**Depth-First Search:** This search algorithm explores all possible path all the way to its conclusion before it takes another path.
**Breadth-First Search**: This can be considered the opposite of the depth-first technique. Here, the algorithm traverses all nodes on the same level before moving to another level.
**Hill-Climbing**: This can be considered an improvement over the depth-first search. After a particular level, it chooses as the next step, the node that tends to place it in the closer to the key or goal node.
**Least-Cost Search Technique**: This technique takes the part of the minimum effort and can be considered the opposite of the Hill-Climbing algorithm
This search is also known a logarithmic search because it takes O(logn) time complexity. It works by iteratively comparing the key value to the middle element of the array. |