Linear Search - Application

Application

Linear search is usually very simple to implement, and is practical when the list has only a few elements, or when performing a single search in an unordered list.

When many values have to be searched in the same list, it often pays to pre-process the list in order to use a faster method. For example, one may sort the list and use binary search, or build any efficient search data structure from it. Should the content of the list change frequently, repeated re-organization may be more trouble than it is worth.

As a result, even though in theory other search algorithms may be faster than linear search (for instance binary search), in practice even on medium sized arrays (around 100 items or less) it might be infeasible to use anything else. On larger arrays, it only makes sense to use other, faster search methods if the data is large enough, because the initial time to prepare (sort) the data is comparable to many linear searches

Read more about this topic:  Linear Search

Famous quotes containing the word application:

    Most people, no doubt, when they espouse human rights, make their own mental reservations about the proper application of the word “human.”
    Suzanne Lafollette (1893–1983)

    The main object of a revolution is the liberation of man ... not the interpretation and application of some transcendental ideology.
    Jean Genet (1910–1986)

    The application requisite to the duties of the office I hold [governor of Virginia] is so excessive, and the execution of them after all so imperfect, that I have determined to retire from it at the close of the present campaign.
    Thomas Jefferson (1743–1826)