Article View: comp.os.ms-windows.programmer.tools.owl
Article #8Re: Searching in a sorted array
From: Brandon Wallace
Date: Mon, 09 Oct 1995 18:33
Date: Mon, 09 Oct 1995 18:33
32 lines
1574 bytes
1574 bytes
In article <44prsv$ki7@news.netvision.net.il>,
galor@netvision.net.il (Guy Naor) writes:
Well, you could treat equality the same as being "greater than". When the search
exits, you should be and the index either, just before the first entry, or
the index of the entry. Then you can just check for equality to see if the
entry exists...
-> Hi!!!
->
-> I'm looking for the best (fastest) way for finding the first occurence
-> of a string in a sorted array, when entries aren't unique. For
-> example:
->
-> an array containing: AA,AB,AC,AD,BB,BB,BB,BC,BF,CG,CG,CT
-> I want to find the first occurance of BB.
->
-> A binary search will stop on the middle BB, and will require a
-> backward serial search to find the first BB. Is there a good algorithm
-> for this?
->
-> Bye,
->
-> Guy.
->
->
--
Brandon Wallace
Nicholas | Applegate Capital Management
mailto:bman@criterion.com http://www.criterion.com/home-pages/brandon
"I live life face down in the fast lane."
Technical Details
Message-ID:
<45bptg$pr1@nacm.com>Path:
arc1-ca.pugleaf.net!nacm.com!usenetReferences:
<44prsv$ki7@news.netvision.net.il>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!nacm.com!usenet From: brandon@criterion.com (Brandon Wallace) Newsgroups: comp.os.ms-windows.programmer.tools.owl,comp.lang.c++ Subject: Re: Searching in a sorted array Date: 9 Oct 1995 18:33:20 GMT Organization: Nicholas|Applegate Capital Management, San Diego, CA Message-ID: <45bptg$pr1@nacm.com> References: <44prsv$ki7@news.netvision.net.il> NNTP-Posting-Host: popeye.criterion.com X-Newsreader: knews 0.9.2 In-Reply-To: <44prsv$ki7@news.netvision.net.il> To: galor@netvision.net.il (Guy Naor)