Sunday, February 28, 2021
More

    What is Binary and Sequential Search means?

    Must Read

    Programmerhttp://www.improgrammer.net
    We started this site to inspire young minds to motivate and encourage them towards Programming Language. In this site you will get programming tutorials, tech, programming facts, programming fun and programming blogs.

    In computer science, a binary search or half-interval search algorithm finds the position of a target value within a sorted array.

    Advantages:

    • Binary search can interact poorly with the memory hierarchy (i.e. caching), because of its
      random-access nature.
    • For in-memory searching, if the interval to be searching is small, a linear search may have superior performance simply because it exhibits better locality of reference.
    • Binary search algorithm employs recursive approach and this approach requires more stack space.
    •  Programming binary search algorithm is very difficult and error prone

    Sequential Search

    In computer science, linear search or sequential search is a method for finding a particular value in a list that checks each element in sequence until the desired element is found or the list is exhausted. The list need not be ordered.

    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.

    Source by: penjee.com

    See more:

    Top 5 Source Code Search Engines

    HTML5 Mastery: Tree Traversal

    Latest Articles

    More Recipes Like This