Dynamic Programming

Optimal Binary Search Tree

Introduced to me in CS341.

Problem Setup

Input:

  • integers (or something else)
  • probabilities of access with Output:
  • an optimal BST with keys
  • optimal: minimizes = expected number of tests for a search

The difficult part is coming up with the recurrence relation.

  • the sum can easily be precomputed with a prefix sum