0% found this document useful (0 votes)
0 views

cs607p

The document calculates the memory space required for the Breadth First Search (BFS) algorithm on a graph with a branching factor of 5 and a depth of 15. The total memory needed is approximately 762,939,453,125 Bytes, which converts to about 744,172,410.77 KB, 726,924.62 MB, and 709.3 GB. The calculations illustrate the significant memory demands of BFS due to the exponential growth of nodes at deeper levels.

Uploaded by

alihamaqbool1
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

cs607p

The document calculates the memory space required for the Breadth First Search (BFS) algorithm on a graph with a branching factor of 5 and a depth of 15. The total memory needed is approximately 762,939,453,125 Bytes, which converts to about 744,172,410.77 KB, 726,924.62 MB, and 709.3 GB. The calculations illustrate the significant memory demands of BFS due to the exponential growth of nodes at deeper levels.

Uploaded by

alihamaqbool1
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment CS607P Solution

Bc123456789

Question:

Breath First Search (BFS) algorithm requires massive memory space whiling
processing a problem even though it has promising time complexity. It is only
because of the branching factor that increase the expansion to search for the
target node. Consider, we have a graph/tree with the branching factor of 5
(each node has 5 neighbor nodes) nodes and depth (or height) 15. Moreover,
each node requires 25 bytes memory space. If the BFS is applied on this
graph/tree, calculate the memory space needed for this algorithm.

Note: You are required to show the memory space in Bytes (B), Kilo Bytes
(KB), Mega Bytes (MB) and Giga Bytes (GB).

Solution:

Given:

Branching Factor (b) = 5

Depth/Height (d) = 15

Memory per node = 25 Bytes

In BFS, the worst-case memory usage is approximately equal to the number


of nodes in the last level of the tree, which is:

Number of nodes at level d=bd=515

Step 1: Calculate number of nodes at depth 15

515 = 30,517,578,125

Step 2: Total memory in Bytes

Memory = 30,517,578,125* 25 = 762,939,453,125Bytes

Step 3: Convert to KB, MB, GB

Kilobytes (KB):

762,939,453,125/1024 ~ 744,172,410.77 KB

Megabytes (MB):
744,172,410.77/1024~ 726,924.62 MB

Gigabytes (GB):

{726,924.62/1024~ 709.3 GB

Final Answer:

Bytes: 762,939,453,125 B

Kilobytes: ~744,172,410.77 KB

Megabytes: ~726,924.62 MB

Gigabytes: ~709.3 GB

You might also like