This preview shows page 1. Sign up to view the full content.
Unformatted text preview: P( two < word) = 0.20. (a) Suppose we implement the negative dictionary via linear search of a list “with one big hole at the end for failed search” . Compute the expected cost of searching for any word in the list, sorted alphabetically, assuming that the cost of finding the first word is 1, the second word is 2, the third word is 3, and any word in the hole is 4. (b) What word order makes the expected linear search cost minimal? (c) Suppose we implement the negative dictionary as a binary search tree. There will now be 4 holes; represent each of them as a “failure node” in the tree. Give two different such search trees and compute the expected cost of searching each tree. Are their expected costs better than for the linear search in (b)? (d) Using either brute force search, or dynamic programming, find a binary search tree with the minimal expected cost of search. Is this optimal search tree a balanced tree?...
View
Full
Document
This note was uploaded on 07/25/2008 for the course CSE 331 taught by Professor M.mccullen during the Spring '08 term at Michigan State University.
 Spring '08
 M.McCullen
 Algorithms, Data Structures

Click to edit the document details