SPUG: search algorithm

Thomas Whitney whitneyt at agcs.com
Mon Dec 17 18:07:15 CST 2001


If I am understanding correctly, it sounds like the directory search is the more
expensive process. How about running through the keys on each file entry, rather
then the other way around.

Tom

Martin Korb wrote:

> Here is the problem: I have 7000 database entries which may or may be found in
> the content of over 50000 files.At the moment I am using a linear search,the
> search patterns are the keys of a hash, find(\&wanted, $startdir) is called on
> each key of the hash, if the key is found, stop recursing the dir, delete this
> key and go the next one, start all over again. This could potentially be over
> 3 x 10 exp 7 searches.Obviously, this will take much to long with a linear
> search algorithm. Which is the best algorithm to use for such a search and
> where can I find out more about it? Any help is much appreciated. Thanks
> Martin


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/





More information about the spug-list mailing list