Optimal Binary Search Trees Find a static search

Optimal Binary Search Trees Find a static search tree that will allow to search for frequent items faster.

Example Input:

The cost of a search tree •

Example Input:






Now we optimize over the choices for the root


We have a recurrence

Video Part 2

We developed the recurrence

Example 0. 4 1 2 3 4 5 0. 4 0. 15 0. 10 0. 15 0. 2 0. 55 0. 65 0. 8 1 0. 15 0. 25 0. 4 0. 6 0. 10 0. 25 0. 45 0. 15 0. 35 0. 2

Example 0. 4 0. 55 0. 65 0. 8 1 0. 15 0. 25 0. 4 0. 6 0. 10 0. 25 0. 45 0. 15 0. 35 0. 2 0. 4 0. 15 0. 10 0. 15 0. 2

Example 0. 4 0. 55 0. 65 0. 8 1 0. 15 0. 25 0. 4 0. 6 0. 10 0. 25 0. 45 0. 15 0. 35 0. 2 0. 4 0. 15 0. 10 0. 15 0. 2

Example 0. 4 0. 55 0. 65 0. 8 1 0. 15 0. 25 0. 4 0. 6 0. 10 0. 25 0. 45 0. 15 0. 35 0. 2 0. 4 0. 70 1 0. 15 0. 35 2 0. 10 0. 35 4 0. 15 0. 50 5 0. 2

Example 0. 4 0. 55 0. 65 0. 8 1 0. 15 0. 25 0. 4 0. 6 0. 10 0. 25 0. 45 0. 15 0. 35 0. 2 0. 4 0. 70 1 1. 0 1 0. 15 0. 35 2 0. 70 3 0. 10 0. 35 4 0. 75 4 0. 15 0. 50 5 0. 2

Example 0. 4 0. 55 0. 65 0. 8 1 0. 15 0. 25 0. 4 0. 6 0. 10 0. 25 0. 45 0. 15 0. 35 0. 2 0. 4 1 0. 70 1 1. 5 0. 15 0. 35 2 0. 70 3 1. 15 4 0. 10 0. 35 4 0. 75 4 0. 15 0. 50 5 0. 2

Example 0. 4 0. 55 0. 65 0. 8 1 0. 15 0. 25 0. 4 0. 6 0. 10 0. 25 0. 45 0. 15 0. 35 0. 2 0. 4 0. 70 1 1. 5 1 2. 15 2 0. 15 0. 35 2 0. 70 3 1. 15 4 0. 10 0. 35 4 0. 75 4 0. 15 0. 50 5 0. 2

Example 0. 4 0. 55 0. 65 0. 8 1 0. 15 0. 25 0. 4 0. 6 0. 10 0. 25 0. 45 0. 15 0. 35 0. 2 0. 4 0. 70 1 1. 5 1 2. 15 2 0. 15 0. 35 2 0. 70 3 1. 15 4 0. 10 0. 35 4 0. 75 4 0. 15 0. 50 5 0. 2 2 1 4 3 5

Summary 0. 4 0. 70 1 1. 5 1 2. 15 2 0. 15 0. 35 2 0. 70 3 1. 15 4 0. 10 0. 35 4 0. 75 4 0. 15 0. 50 5 0. 2 2 1 4 3 5

Running time

Extensions Can be extended to handle inputs of the form:
- Slides: 25