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:

    The receipt to make a speaker, and an applauded one too, is short and easy.—Take of common sense quantum sufficit, add a little application to the rules and orders of the House, throw obvious thoughts in a new light, and make up the whole with a large quantity of purity, correctness, and elegancy of style.
    Philip Dormer Stanhope, 4th Earl Chesterfield (1694–1773)

    Great abilites are not requisite for an Historian; for in historical composition, all the greatest powers of the human mind are quiescent. He has facts ready to his hand; so there is no exercise of invention. Imagination is not required in any degree; only about as much as is used in the lowest kinds of poetry. Some penetration, accuracy, and colouring, will fit a man for the task, if he can give the application which is necessary.
    Samuel Johnson (1709–1784)

    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)