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

U NIVERSITY OF THE W ITWATERSRAND , J OHANNESBURG

School of Computer Science and Applied Mathematics

Advanced Analysis of Algorithms – COMS3005A


Laboratory 2
Searching Approaches

Ian Sanders

First semester, 2023 Academic Year

1 Aim
This laboratory covers uninformed search, informed search and adversarial search. The aim of the labo-
ratory is for the students to gain a better understanding of the approaches by implementing and running
them on some test data.

Note: You should be able to do question 1 in the remaining lab time (after the SD assesment). Ques-
tions 2 and 3 can be done in your own time as part of your preparation for your final exam (if you feel
you need to do them).

2 Questions
1. Implement the breadth first search algorithm as per the lecture slides. Then use the search tree in
Figure 1 as input to your program. Use different nodes as the goal node.
Note: I do not mind what programming lanaguage you implement the search in. The point is to
understand the approach. I don’t even mind if you download and run code that someone else has
written but you must make sure you understand the code and the algorithm. This understanding
will potentially be assessed in the class test and the final examination.

2. Implement the Uniform Cost Search method and test it on the graph in Figure 2. Try using different
start and goal states.

3. Implement Alpha-Beta Search and then run it on the game trees in Figures 3 and 4.

1
O

M E

D C L B

K I J H F G N A

Figure 1: Search Tree

2
A

11

B 20

15

D 4

24
14
22 F

G E

9
12

Figure 2: Search Graph (Uniform Cost Search (UCS))

B C D

E F G H I J K L M

3 12 8 2 4 6 14 5 2

Figure 3: A game tree for a very simple game

3
A

B C

D E F

8 9

I J

M N

4 7

Figure 4: Adversarial Search Tree

You might also like