Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!cs.utexas.edu!sun-barr!texsun!playroom!cliffs From: cliffs@sunrock.east.sun.com (Clifford C. Skolnick) Newsgroups: comp.lang.c Subject: Re: search Message-ID:Date: 18 Aug 89 23:15:42 GMT References: <184@stsim.UUCP> Sender: news@playroom.UUCP Lines: 21 In-reply-to: glenn@stsim.UUCP's message of 17 Aug 89 13:19:22 GMT In article <184@stsim.UUCP> glenn@stsim.UUCP (Glenn Ford) writes: I am writing a small project (not related to work, personal) that has to do search's on a sorted database. I search off the keyword which is string of N length and is unique to all other keys. For right now I do a binary search off the database, but this tends to be slow when run off a floppy drive (yes, it has to run on a floppy drive in SOME cases). My question is: Is there a faster, yet fairly easy to implement, routine that can search my database? Faster than binary search.. I don't want B-Tree's. My database is allready built. Glenn Ford ..uunet!ocsmd!stsim!glenn Perhaps you could make a better guest on your binary search start. Say look at the first character and make a guess about where to start in the file. You can also branch on much less, less, equal, greater, and much greater. This will be a bit faster than a binary search. You say you are using a binary search now, so not much more logic is needed. Cliff