Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary EASY LEARN

Rating
-
Sold
-
Pages
27
Uploaded on
13-08-2025
Written in
2025/2026

Summary of 27 pages for the course ocs351 at Anna University Chennai (100% PASS RESULT)

Institution
Course

Content preview

LIST OF EXPERIMENTS


1. Implementation of Uninformed search algorithms (BFS, DFS)

2. Implementation of Informed search algorithms (A*, memory-

bounded A*)
3. Implement naive Bayes models

4. Implement Bayesian Networks

5. Build Regression models

6. Build decision trees and random forests

7. Build SVM models

8. Implement ensembling techniques

9. Implement clustering algorithms

10.Implement EM for Bayesian networks

11.Build simple NN models

12.Build deep learning NN models

,Ex. No. 1.A UNINFORMED SEARCH ALGORITHM - BFS

Date:




Aim:
To write a Python program to implement Breadth First Search (BFS).

Algorithm:

Step 1. Start
Step 2. Put any one of the graph’s vertices at the back of the queue.
Step 3. Take the front item of the queue and add it to the visited list.
Step 4. Create a list of that vertex's adjacent nodes. Add those which are not within the
visited list to the rear of the queue.
Step 5. Continue steps 3 and 4 till the queue is empty.
Step 6. Stop

Program:

graph = {
'5' : ['3','7'],
'3' : ['2', '4'],
'7' : ['8'],
'2' : [],
'4' : ['8'],
'8' : []
}

visited = [] # List for visited nodes.
queue = [] #Initialize a queue

def bfs(visited, graph, node): #function for BFS
visited.append(node)
queue.append(node)

while queue: # Creating loop to visit each node
m = queue.pop(0)
print (m, end = " ")

for neighbour in graph[m]:
if neighbour not in visited:
visited.append(neighbour)
queue.append(neighbour)

# Driver Code
print("Following is the Breadth-First Search")
bfs(visited, graph, '5') # function calling

, Viva questions:

1. What is BFS and how does it differ from other search algorithms such as DFS or A*
search?
2. Can you describe the steps of a BFS algorithm and explain how it works?
3. Can you explain the time and space complexity of a BFS algorithm?
4. Can you give an example of a real-world problem that can be solved using BFS?
5. What does the "visited array" in BFS refer to?




Result:

Thus the Python program to implement Breadth First Search (BFS) was developed
successfully.

Written for

Institution
Course

Document information

Uploaded on
August 13, 2025
Number of pages
27
Written in
2025/2026
Type
SUMMARY

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
viratmari

Get to know the seller

Seller avatar
viratmari kathir college of engineering
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
9 months
Number of followers
0
Documents
26
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions