Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Exercise Set - 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

School of Computer Science Engineering & Information Systems

Fall Sem – 2024 - 2025


Exercise Set - 1

Programme : B.Tech (IT)


Course Title : Artificial Intelligence Course Code: BITE308P

1. Assume that you will be given an undirected graph represented as an adjacency list and a
starting vertex. Implement a function BFS(graph, start) that performs Breadth-First
Search starting from the given vertex. The function should return a list of vertices visited
in BFS order.

2. Assume that you will be given an undirected graph represented as an adjacency list and a
starting vertex. Implement a function DFS(graph, start) that performs Breadth-First
Search starting from the given vertex. The function should return a list of vertices visited
in DFS order.

3. The Missionaries and Cannibals problem is a classic river-crossing puzzle that involves
moving missionaries and cannibals from one side of a river to the other. The challenge is
to find a sequence of moves that allows all missionaries and cannibals to cross without
violating certain rules. The rules usually include constraints on the number of
missionaries and cannibals on each side of the river, and ensuring that the cannibals don't
outnumber the missionaries on either side.
Create an implementation of the Missionaries and Cannibals problem using a simple BFS
algorithm in Python.

1
School of Computer Science Engineering & Information Systems

4. The 8-Queens problem is a classic problem in computer science. The goal is to place
eight queens on a chessboard in such a way that no two queens threaten each other. This
means that no two queens can be in the same row, column, or diagonal.
Make an implementation of the N-Queens problem in Python using a backtracking
algorithm:

5. Uniform Cost Search (UCS) is a search algorithm that explores a weighted graph by
expanding the least-cost node. It is often used for finding the shortest path in a graph with
non-negative edge weights.
Make an implementation of the Uniform Cost Search algorithm in Python.

6. Iterative Deepening Search (IDS) is a combination of depth-first search and breadth-first


search. It repeatedly performs depth-first search with increasing depth limits until the
goal is found. This allows the algorithm to explore deeper levels gradually, avoiding the
disadvantages of pure depth-first or breadth-first search.
Make an implementation of the Iterative Deepening Search in Python.

7. Depth Limited Search is a modified version of DFS that imposes a limit on the depth of
the search. This means that the algorithm will only explore nodes up to a certain depth,
effectively preventing it from going down excessively deep paths that are unlikely to
lead to the goal. By setting a maximum depth limit, DLS aims to improve efficiency
and ensure more manageable search times.
Make an implementation of the Depth Limited Search in Python.

You might also like