From: Pit Capitain Date: 2002-02-09T11:47:39+09:00 Subject: Re: Reg: tiny contest: who's faster? (add_a_gram) On 9 Feb 2002, at 8:19, Dave Thomas wrote: > grady@xcf.berkeley.edu (Steven Grady) writes: > > > My solution takes under a minute on my machine; the majority is the > > building of the word hashes. Some of the basic techniques are: > > I'm not sure if we're necessarily going for speed, but the following > runs about three times faster on my box. The time taken reading in > seems to swamp the other times. 1.7 runs it about 5% faster, which is > surprising: I thought the GC mods would make a bigger difference. Hi Dave, your code is fast, but you are cheating (a little bit ;-) Here are two word lists that break the algorithm: Longest add-a-gram not beginning at 3 or less letters: nitons intones mentions nominates antimonies inseminator terminations antimodernist determinations underestimation underestimations ant ante antre atoner another antihero anorthite anorthites antistrophe attorneyship Longest add-a-gram with less than 12 letters: at ant ante To be able to compare several implementations, we should specify the programs' task more clearly: * Should it only work with the given or with any word list? * Should it only print the last word or the whole sequence? * In which form should it print the result? * Is it allowed to use C extensions or has it to be pure Ruby? Regards, Pit