Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

WEEK 3 Task Sheet

Task 1: Search Algorithms

Do some background research on the search algorithms and methods we have looked at today
and produce a scenario where each one might be used and a set of pros and cons for each of
them?

Search algorithms:

Each search algorithm makes use of a search key. It is typical for Boolean true/false to denote a
success or failure status to be returned by search algorithms. There are a variety of search
algorithms available, whose performance and effectiveness are influenced by the data and their
use.

Scenario:

AI recommender system is used by one of the largest providers of music streaming services
called Spotify which is an audio streaming and media service. It predicts the user's choice and
provides relevant suggestions to the user. Search algorithms can be used in the AI recommender
system of the company. There are different search algorithms with their pros and cons which are
given below:

Uninformed Search Algorithms:

Uniformed Search Algorithms can be used from the scenario. A subset of general-purpose, brute-
force-based search algorithms is known as uninformed search. It is also referred to as a blind
search because it lacks any other than how to move through the tree, additional data regarding
the state, or search space. The Pros and Cons of the various kinds of uninformed search
algorithms are as follows:

 Breadth-first Search
 Depth-first Search
 Depth-Limited Search Algorithm

Breadth-first Search:
The most common method for traversing a tree or graph is a breadth-first search. Breadth-first
search is the method by which this algorithm conducts a breadthwise search of a tree or graph. It
is an illustration of a general-diagram search calculation.

 Pros:
BFS will provide the simplest solution with the fewest steps if there are multiple
solutions to a problem.
 Cons
The tree uses a lot of memory because each level must be saved in memory before
moving on to the next level.

Depth-first Search

Depth-first search is a recursive method for traversing a tree or graph data structure. Because it
begins at the root node and moves along each path until it reaches the greatest depth node, and
on to the next one, it is referred to as the depth-first search.

 Pros
Because it only needs to keep a stack of nodes from the current node to the root node,
DFS uses very little memory.
 Cons
Deep-level searching and an infinite loop may occasionally be utilized by the DFS
algorithm.

Depth-Limited Search Algorithm:

Similar to depth-first search, a depth-limited search algorithm has a predetermined limit. In


contrast to depth-first searches, which suffer from an infinite path, depth-limited searches do not.
The node at the depth limit in this algorithm will be treated as if it has no more successor nodes.

 Pros
Memory is used less in depth-limited searches.
 Cons
If there are multiple solutions to the problem, it might not be best.

Informed Search Algorithm:


The informed search algorithm better serves large search spaces. An educated hunt calculation
utilizes the possibility of a heuristic, also called Heuristic search. Informed Search makes use of
a function called a heuristic to determine the most promising path. It estimates how far away the
agent is from the goal using its current state as its input. The Pros and Cons of the various kinds
of informed search algorithms are as follows:

 Best First Search Algorithm(Greedy search)


 A* Search Algorithm

Best-first Search Algorithm (Greedy Search):

A narcissistic best-first search algorithm will always choose the path that looks the best right
now. It is an amalgamation of algorithms that prioritize breadth-first and depth-first searches.
Search and the heuristic function are used. With best-first search, we can use both algorithms to
our advantage.

 Pros
The advantages of both BFS and DFS can be accessed by switching the best first search
between them.
 Cons
It might act like an unguided depth-first search in the worst-case scenario.

A* Search Algorithm:

The most well-known type of best-first search is an A* search. It utilizes heuristic capability
h(n), and cost to arrive at the hub n from the very outset state g(n). It effectively solves the issue
by combining UCS and greedy best-first search features.

 Pros
Compared to other search algorithms, the A* algorithm is superior.
 Cons
Because it is primarily based on heuristics and approximations, it doesn't necessarily
deliver the briefest way.

You might also like