GATE Computer ScienceVery hardGATE CSE

Five keys k1<k2<k3<k4<k5 are searched with access frequencies 4, 2, 6, 3, 9. For a binary search tree over these keys, with the root at depth 1, the minimum possible total of (frequency × depth) is

  1. A. 51
  2. B. 47
  3. C. 44
  4. D. 56

Correct answer: B. 47

The optimal-BST DP (cross-checked by exhaustive recursion) gives 47.

More Algorithms questions

Exams that ask this topic