word probability am and egg if the two figure sample input for optimal binary search tree problem if egg two and am and am the the and if two if am egg two egg the figure three possible binary search trees for data in previous table the first tree was formed using greedy strategy the word with the highest probability of being accessed was placed at the root the left and right subtrees were then formed recursively the second tree is the perfectly balanced search tree neither of these trees input word wi probability pi am and egg if the two totals tree # tree # tree # access cost once sequence access cost once sequence access cost once sequence figure comparison of the three binary search trees