Interpolation Search - Adaptation To Different Datasets

Adaptation To Different Datasets

When sort keys for a dataset are uniformly distributed numbers, linear interpolation is straightforward to implement and will find an index very near the sought value.

On the other hand, for a phone book sorted by name, the straightforward approach to interpolation search doesn't apply. The same high-level principles can still apply, though: one can estimate a name's position in the phone book using the relative frequencies of letters in names and use that as a probe location.

Some interpolation search implementations may not work as expected when a run of equal key values exists. The simplest implementation of interpolation search won't necessarily select the first (or last) element of such a run. The interpolation calculation also must be written to avoid division by zero.

Read more about this topic:  Interpolation Search

Famous quotes containing the words adaptation to and/or adaptation:

    The real security of Christianity is to be found in its benevolent morality, in its exquisite adaptation to the human heart, in the facility with which its scheme accommodates itself to the capacity of every human intellect, in the consolation which it bears to the house of mourning, in the light with which it brightens the great mystery of the grave.
    Thomas Babington Macaulay (1800–1859)

    In youth the human body drew me and was the object of my secret and natural dreams. But body after body has taken away from me that sensual phosphorescence which my youth delighted in. Within me is no disturbing interplay now, but only the steady currents of adaptation and of sympathy.
    Haniel Long (1888–1956)