Wow! Thanks Bernardo. The technique you proposed is the most eye-opening
use of Perl I have seen in a long while. I woke in the middle of the night
and searched through all my Perl books. None mention this: not Algorithms
with Perl, or Advanced perl, or Object Oriented Perl. (I do not own the
On Friday 10 July 2009 06:01:27 Steve Tolkin wrote:
Wow! Thanks Bernardo. The technique you proposed is the most eye-opening
use of Perl I have seen in a long while. I woke in the middle of the night
and searched through all my Perl books. None mention this: not Algorithms
with Perl, or
On Thu, Jul 09, 2009 at 07:03:20PM -0400, Bernardo Rechea wrote:
For reference, the brute force algorithm:
Brute force
T: foreach my $targetWord (@targetWords) {
foreach my $searchWord (@searchWords) {
if ($targetWord =~ /^$searchWord/) {
push @foundWords,
I tried to explain in the O.P. It is search based on matching the string
prefix, and so is not exact search. I have a large set of target strings,
about 250,000. I have a set of search strings, about 7,500. Assume both
arrays are sorted. In pseudo-code (pseudo-perl):
S: for each $s in
On Wed, Jul 08, 2009 at 08:33:34PM -0400, Steve Tolkin wrote:
I want to search a sorted array to see if which strings, if any, have the
same prefix as my search string. For example, given the search string of
tempest I want to find tempests and tempestuous. My word list has
about 250,000
On Thursday 09 July 2009 17:17:40 Ronald J Kimball wrote:
On Wed, Jul 08, 2009 at 08:33:34PM -0400, Steve Tolkin wrote:
I want to search a sorted array to see if which strings, if any, have
the same prefix as my search string. For example, given the search
string of tempest I want to find
-Original Message-
From: Ronald J Kimball
Sent: Thursday, July 09, 2009 10:18 AM
Subject: Re: [Boston.pm] binary search on a list of sorted strings in memory
Another option would be a dictionary tree, in which each node is a single
letter, so each word is represented by a path through
On Thursday 09 July 2009 10:17:40 Ronald J Kimball wrote:
On Wed, Jul 08, 2009 at 08:33:34PM -0400, Steve Tolkin wrote:
I want to search a sorted array to see if which strings, if any, have
the same prefix as my search string. For example, given the search
string of tempest I want to find
I want to do a binary search on a list of strings in memory. Basically I
want the bsearch functionality, also implemented in Search::Dict.
Unfortunately that is documented to only work for a list of strings in a
file.http://search.cpan.org/~nwclark/perl-5.8.9/lib/Search/Dict.pm says
in part:
ST == Steve Tolkin stevetol...@comcast.net writes:
ST I want to do a binary search on a list of strings in memory.
ST Basically I want the bsearch functionality, also implemented in
ST Search::Dict.
ST I want to search a sorted array to see if which strings, if any,
ST have the same
10 matches
Mail list logo