Let T be a full binary tree with 8 leaves. (A full binary tree has every level full.) Suppose two leaves a and b of T are chosen uniformly and independently at random. The expected value of the distance between a and b in T (i.e., the number of edges in the unique path between a and b) is (rounded off to 2 decimal places).

This question was previously asked in
GATE CS 2019 Official Paper
View all GATE CS Papers >

Answer (Detailed Solution Below) 4.25

Free
GATE CS Full Mock Test
5.3 K Users
65 Questions 100 Marks 180 Mins

Detailed Solution

Download Solution PDF

Full binary tree with 8 leaves:

F1 R.S M.P 19.08.19 D3

Since any two leaves is chosen uniformly and independently at random

Possible distance: 0, 2, 4, and 6

Leaves with 0 distance:

{(p, p), (q, q), (r, r), (s, s), (t, t), (u, u), (v, v), (w, w)}

 Leaves with 2 distance:

{(p, q), (q, p), (r, s), (s, r), (t, u), (u, t), (v, w), (w, v)}

Leaves with 4 distance:

{(p, r), (r, p), (p, s), (s, p), (q, r), (r, q), (q, s), (s, q),

(t, v), (v, t), (t, w), (w, t), (u, v), (v, u), (u, w), (w, u),}

Leaves with 6 distance:

{(p, t), (t, p), (p, u), (u, p), (p, v), (v, p), (p, w), (w, p),

(q, t), (t, q), (q, u), (u, q), (q, v), (v, q), (q, w), (w, q),

(r, t), (t, r), (r, u), (u, r), (r, v), (v, r), (r, w), (w, r),

(s, t), (t, s), (s, u), (u, s), (s, v), (v, s), (s, w), (w, s)}

Total nodes possible with 0, 2, 4, and 6 distance is 64.

xi

0

2

4

6

ni

8

8

16

32

pi

8/64

8/64

16/64

32/64

 

\(E\left( {{x_i}} \right) = \mathop \sum \limits_{i = 1}^4 {x_i}{p_i}\)

\(E\left( {{x_i}} \right) = 0 \times \frac{8}{{64}} + 2 \times \frac{8}{{64}} + 4 \times \frac{{16}}{{64}} + 6 \times \frac{{32}}{{64}}\)

\(E\left( {{x_i}} \right) = \frac{1}{4} + 1 + 3 = 4.25\)

The expected value of the distance between a and b in T is 4.25.
Latest GATE CS Updates

Last updated on Jan 8, 2025

-> GATE CS 2025 Admit Card has been released on 7th January 2025.

-> The exam will be conducted on 1st February 2025 in 2 shifts.

-> Candidates applying for the GATE CE must satisfy the GATE Eligibility Criteria.

-> The candidates should have BTech (Computer Science). Candidates preparing for the exam can refer to the GATE CS Important Questions to improve their preparation.

-> Candidates must check their performance with the help of the GATE CS mock tests and GATE CS previous year papers for the GATE 2025 Exam.

More Complete Binary Tree Questions

More Tree Questions

Hot Links: teen patti lotus real teen patti teen patti sweet