Binary Search ¡ Binary search can perform operations get, floorEntry and ceilingEntry on an ordered map implemented by means of an array-based sequence, sorted by key ¡ similar to the high-low game ¡ at each step, the number of candidate items is halved ¡ terminates after O(log n) steps Binary Search Trees

Search Tables ¡ A search table is an ordered map implemented by means of a sorted sequence ¡ We store the items in an array-based sequence, sorted by key ¡ We use an external comparator for the keys

Search Tables ¡ Performance: ¡ get, floorEntry and ceilingEntry take O (log n ) time, using binary search ¡ insert takes O ( n ) time since in the worst case we have to shift n items to make room for the new item ¡ remove take O ( n ) time since in the worst case we have to shift n items to compact the items after the removal ¡ The lookup table is effective only for dictionaries of small size or for dictionaries on which searches are the most common operations, while insertions and removals are rarely performed (e.g., credit card authorizations)

This preview
has intentionally blurred sections.
Sign up to view the full version.