You are on page 1of 7

UOG

ASSIGNMNET NO: 1
NAME: ARFAN YOUSAF
SUB: ARTIFICAL INTELLEGENCE
R.NO: 16471556-064
CLASS: BSIT-16
SUBMITTED TO: SIR SALMAN
Question#1

Apply DFS and BFS on the above graph and construct the table with Que and
Visited nodes on each iteration. Set the Goal as last digit of your REG + 1. For
example, if your REG is 15919185-001 then the Goal state will be “2”. (6 Marks)

Question#2
How many nodes are expanded (in the worst case) by each of the following
search techniques when searching a tree with branching factor ‘b’ to find a goal at
a depth of ‘d’? You can use ellipses in your answer to indicate a sequence. Do not
use big Oh notation. (4 Marks)
Depth First Search:
Breadth First Search:
SOL#1:- BFS

Queue

1
Order of Visit

………………

Queue

1 2 7 8
Order of Visit

Queue

1 2 7 8 3 6
Order of Visit

1 2

………………

Queue

1 2 7 8 3 6
Order of Visit

1 2 7

………………

Queue

1 2 7 8 3 6 9 12
Order of Visit

1 2 7 8

………………

Queue

1 2 7 8 3 6 9 12 4 5
Order of Visit

1 2 7 8 3

………………

Queue

1 2 7 8 3 6 9 12 4 5
Order of Visit

1 2 7 8 3 6

………………

Queue

1 2 7 8 3 6 9 12 4 5 10 11
Order of Visit

1 2 7 8 3 6 9

………………

Queue

1 2 7 8 3 6 9 12 4 5 10 11
Order of Visit

1 2 7 8 3 6 9 12

………………

Queue
1 2 7 8 3 6 9 12 4 5 10 11
Order of Visit

1 2 7 8 3 6 9 12 4

………………

Queue

1 2 7 8 3 6 9 12 4 5 10 11
Order of Visit

1 2 7 8 3 6 9 12 4 5

………………

Last digit of my reg no is 4+1=5

So 5th node is the for me.


DFS

Stack

1
Order of Visit

………………

Stack

1 2 7 8
Order of Visit

………………

Stack

1 2 7 8 3 6
Order of Visit

1 2

………………

Stack

1 2 7 8 3 6 4 5
Order of Visit

1 2 3

………………

Stack

1 2 7 8 3 6 4 5
Order of Visit

1 2 3 4
………………

Stack

1 2 7 8 3 6 4 5
Order of Visit

1 2 3 4 5

………………

Last digit of my reg no is 4+1=5

So 5th node is the for me.

You might also like