Binary Search to search linearizer table?

Discussion in 'C Programming' started by Andy, Nov 24, 2003.

  1. Andy

    Andy Guest

    Say given the linearizer table and the key as
    tbl[] = {1, 10, 12, 25, 35, 47};
    KEY = 1

    Can Binary Search be used to find the enclosing segments?
    In this case KEY is enclosed by the segments 1 and 10 (items
    0 and 1).
    Can Binary Search be used in general to find the
    enclosing segments for any key in any given table?

    Andy, Nov 24, 2003
    1. Advertisements

  2. Andy

    Jack Klein Guest

    What Binary Search? Searching algorithms are topical in a group like

    As far as the standard C library bsearch is concerned, the answer is
    no except for the special cases where the key matches one of the
    delimiters. If you search for a key of 2 (or 3, or 4, or any number
    up to 9), the only result you get is a null pointer. bsearch does not
    provide any information on where it gave up.

    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    Jack Klein, Nov 25, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.