Searches in AI, BFS & DFS Search with Examples.pptx
bk996051
24 views
33 slides
Jul 15, 2024
Slide 1 of 33
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
About This Presentation
That is a presentation about the Basic Searches of AI, included BFS, DFS and their Pros and cons
Size: 18.16 MB
Language: en
Added: Jul 15, 2024
Slides: 33 pages
Slide Content
بِسْمِ ٱللَّهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ
ARTIFICIAL INTELLIGENCE PRESENTATION
HAFIZA MEHAK ARIF ROLL NO 03 the GROUP MEMBERS FIZZA RUBAB ROLL NO 12 MUHAMMAD BILAWAL KHAN ROLL NO 14
CONTENTS BFS CODE & GRAPH 1 DFS CODE & GRAPH 2 INFORMED & UNINFORMED SEARCHES 3 PRACTICAL APPLICATIONS 4 PROS AND CONS OF SEARCHES 5 COMPLEXITIES OF SEARCHES 6
BFS stands for Breadth-First Search, a graph traversal algorithm for searching and exploring nodes in a graph or tree data structure. It starts at a selected node (the root or source node) and explores all of its neighbors before moving on to the next level of nodes. breadth-first search 1
Bfs code & graph QUEUE: A VISITED: QUEUE: D, B VISITED: A QUEUE: B,C VISITED: A D A code graph
Bfs code & graph QUEUE: C G E VISITED: A D B QUEUE: G E VISITED: A D B C QUEUE: E H VISITED: A D B C A code graph
Bfs code & graph QUEUE: H F VISITED: A D B C E QUEUE: H VISITED: A D B C E F QUEUE: VISITED: A D B C E F H A code graph
FINAL BFS RESULT...
...
BFS PATH A D B C G E F H
DEPTH-FIRST SEARCH 2 DFS stands for Depth-First Search, which is a graph traversal algorithm used to search and explore nodes in a graph or tree data structure. It starts at a selected node (the root or source node) and explores as far as possible along each branch before backtracking
code graph DFS code & graph STACK: A VISITED: STACK: I F B VISITED: A STACK:F B VISITED: A I
code graph DFS code & graph STACK: B G VISITED: A I F STACK: B E C VISITED: A I F G STACK:B C D VISITED: A I F G E
code graph 3 DFS code & graph STACK:B D VISITED: A I F G E C STACK: B D VISITED: A I F G E C STACK:F B VISITED: A I
code graph 3 DFS code & graph STACK:B D VISITED: A I F G E C B D H
FINAL BFS RESULT...
...
BFS PATH A I F G E C B D H
3 Informed searches are like having a map when you're trying to find your way. They use extra information about the problem to guide the search process. This extra information helps them make smarter decisions about which path to take next. Informed searches are like having a hint or clue that helps you move in the right direction. They save time and effort by focusing on the most promising options first. A Informed Uninformed informed & uninformed searches Uninformed searches, on the other hand, are like searching blindly. They don't have any extra information about the problem. So, they have to explore all possible options one by one until they find a solution. Uninformed searches are like exploring a maze with no map. You try one path, then another, without knowing if you're getting closer to the exit. They can be time-consuming and may not always find the best solution..
Finding the Shortest Path Beating Games Understanding Language Recognizing Things in Pictures Making Schedules Find the shortest route for you Chess or video games Find what you're looking for Familiar faces or objects O rganize tasks at work like personal assistant practical applications 4
5 - Faster: These are like having a map. They use extra information to make smart decisions about which path to take. This makes them faster than uninformed searches.- Efficient: With the help of extra clues, & can focus on the most promising options first, leading to more efficient solutions.- Optimal Solutions: They use additional knowledge to guide the search process. - Need for Heuristic: Informed searches rely on heuristic information, which may not always be accurate. If the heuristic is wrong, it could lead the search in the wrong direction.- Complexity: Sometimes, the extra information used in informed searches can make them more complex to implement and understand. PROS CONS informed searches
5 Simple: Uninformed searches are straightforward. They explore all possible options without any extra information, making them easy to implement.- Complete: Uninformed searches are guaranteed to find a solution if one exists. They exhaustively search through all possible paths. Time-consuming: Since uninformed searches don't use any extra information, they might explore many unnecessary paths, which can be time-consuming.- Inefficient: Without guidance, uninformed searches may take longer to find a solution than informed searches, especially in complex problem spaces. PROS CONS UNinformed searches
TIME COMPLEXITIES SPACE COMPLEXITIES 6 COMPLEXITIES OF SEARCHES
Time Complexity: The time complexity of informed searches varies depending on the specific algorithm used, but they generally have better time complexity than uninformed searches. - Space Complexity: Informed searches typically require more memory space compared to uninformed searches because they need to store additional information, such as heuristic values or priority queues. Complexity of informed search 6
Time Complexity: Uninformed searches usually have higher time complexity compared to informed searches because they systematically explore all possible paths without any additional information to guide the search. - Space Complexity: Uninformed searches generally have lower space complexity compared to informed searches because they don't require storing extra information like heuristic values. Complexity of uninformed search 6