Optimal binary search tree construction and rendering