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

Name: Muhammad Haroon Farooqi

Id: BC210209149
CS607

Question No. 01

Consider the following tree, use simple search algorithm (given on page# 24 of

handouts) and apply the Depth First Search (DFS) strategy. The starting node is 1, and

the goal node is 7. You are required to fill out only the given Table.

Solution:

Sr No Q - List Visited List

1 1 1

2 2, 3 1, 2, 3

3 2, 4, 5 1, 2, 3, 4, 5

4 5, 7, 8 1, 2, 5, 7, 8

5 3,6 1, 3, 6

6 3, 6, 9 1, 3, 6, 9
Question No. 02:

Breath First Search (BFS) is a memory hungry search strategy which means it requires
a lot of memory whiling processing a problem even having a reasonable and moderate
complexity. It is primarily due to the branching factor that increase the number of ways
to search for the solution (goal/target).
Now, consider that we have a tree with the branching factor of 4 and depth (or height)
12, while each node requires 16 bytes storage. If the Breath First Search (BFS) is
applied to this tree, then calculate the memory required for this search.
Solution:
Given:

Branching factor (b) = 4


Depth (height) of the tree (d) = 12
Storage required per node = 16 bytes
At each level of the tree, the number of nodes can be calculated as b^d, where b is the
branching factor and d is the depth of the tree.
4^12= 16,777,216
Storage required per node= 16
Total memory for each level:
memory required=16777216*16= 268,435,456
memory required for this search = 256 Mbs.

You might also like