By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,656 Members | 968 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,656 IT Pros & Developers. It's quick & easy.

Binary Search to search linearizer table?

P: n/a
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?

TIA
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 24 Nov 2003 14:04:38 -0800, bi*****@hotmail.com (Andy) wrote in
comp.lang.c:
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?

TIA


What Binary Search? Searching algorithms are topical in a group like
news:comp.programming.

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
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.