This method has made me realize how I can alter the spellcheck routine we use at work...
Instead of checking to see if each word is in the list (174,000 words!) I will split the list into an array, with each key named for the word, and do what he did here! Who'd've thought that a fun puzzle would lead to acquiring such an important bit of knowledge? -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jim Hurley Sent: Friday, July 22, 2005 9:09 AM To: [email protected] Subject: Re: NPR puzzle > >Message: 8 >Date: Thu, 21 Jul 2005 14:19:37 -0700 >From: Dick Kriesel <[EMAIL PROTECTED]> >Subject: Re: NPR puzzle >To: How to use Revolution <[email protected]> >Message-ID: <[EMAIL PROTECTED]> >Content-Type: text/plain; charset="US-ASCII" > >Here's a solution that takes 10 milliseconds on a 1GHz PowerBook G4. > >The main reason for the speed improvement over previous solutions is that >array look-ups are typically faster than string searches. > > put the milliseconds into tMilliseconds > repeat for each line tSymbol in field 2 > put "true" into tSymbolArray[tSymbol] > end repeat > repeat for each word tWord in field 1 > if tSymbolArray[char 1 to 2 of tWord] then > if tSymbolArray[char 3 to 4 of tWord] then > if tSymbolArray[char 5 to 6 of tWord] then > if tSymbolArray[char 7 to 8 of tWord] then > if tSymbolArray[char 9 to 10 of tWord] then > put tWord & return after tHits > end if > end if > end if > end if > end if > end repeat > put the milliseconds - tMilliseconds \ > into tElapsedMilliseconds > put number of lines in tHits && "hits in" \ > && tElapsedMilliseconds && "milliseconds" \ > & return & return & tHits > >-- Dick Dick, Dazzling! Jim _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
