Hi,
If the list is an array, I assume you know how many words there are.
Compare 'strcmp()' the search word(SW) with the middle list word.
If the SW is greater then compare the SW with the list word half way between the
middle list word and the last list word. If SW is less than middle list word compare the SW with the list word between the first list word and the middle list word.
given SW = 'any' and the list you posted
compare any to bag
any is less than bag
compare any to an
any is greater than an
compare any to any
any is the same as any DONE
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.