Explanation : If we consider a small graph with 5 vertices, then the minimum spanning tree will have a weight 4.
So, for n-vertices, MST weight would be (n – 1)
As n = 100 (no. of vertices), So, minimum spanning tree weight = (100 – 1) = 99
Explanation : Let n = 3
0 ϵ < 0,1]3
x = 0 or 1
= x1 = x3 (∵ a1 = 1, a2= 0, a3 = 1)
= 0 or 1 or 1 or 2.
= x3 (∵ a1 = a2 = 0)
= 0 or 1
Total number of cases = 2 × 3 + 4 × 3 = 18
Now odd number of cases = 9
P = 9/18 = 0.5
Explanation : Min-heap contains 1023 elements.
Min-heap means, parent should be minimum or equal to it’s children so, max children could be either left or right one.
Following this logic, maximum can be definitely at leaf nodes.
No. of elements in leaf = n/2 = 1023/2 = 512
To find maximum among 512 elements, no. of comparisons needed is 511.