Aptitude | GATE CS 1998 | Question 51

The overlay tree for a program is as shown below:

hier

What will be the size of the partition (in physical memory) required to load (and run)  this program?



 
(A) 12 KB
(B) 14 KB
(C) 10 KB
(D) 8 KB


Answer: (B)

Explanation: Depth First Traversal from left to right. when we visit a node for first time, it is loaded in main memory and when we visit it for last time, it is pulled out.
For the above program, maximum memory will be required when running code portion present at leaves.

For D = 2+4+6 = 12
For E = 2+4+8 = 14
For F = 2+6+2 = 10
For G = 2+8+4 = 14

Max(12, 14, 10, 14) = 14


Quiz of this Question



My Personal Notes arrow_drop_up