Skip to content
GATEiit

GATE CSE 2019 Q56: Expected distance between two random leaves of a full binary tree with 8 leaves

Syllabus topic: Random variables

Question

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) ________.

Try it: numerical answer: type the value

Numerical answer. No negative marking.
Show answer and explanation

Answer: 4.25 (official GATE 2019 final answer key)

Concept used: Expectation = sum over possible distances of distance × probability; for fixed leaf a, the distance to b is twice the height of their lowest common ancestor, and b=a is allowed since the choices are independent.

Concept notes

Loading notes…

First step: Fix a; of the 8 equally likely choices of b, count how many give distance 0, 2, 4 and 6 (same leaf, sibling, same subtree of height 2, other half).

Full step-by-step solution

Loading…

Answer from the official final answer key. Found a mistake? Use Report issue and we will fix it.

More questions on Random variables

Every PYQ on this topic →

Share this question

WhatsAppDownload image

Source: official GATE 2019 CS question paper and final answer key, organised by IIT Madras. Question paper · Answer key