From: Harry Kakueki Date: 2009-07-24T13:18:37+09:00 Subject: Re: Is recusion the best? On Fri, Jul 24, 2009 at 11:47 AM, Li Chen wrote: > Hi all, > > I have some codes  implemented with recursion. When the loop/recursion > number is small  everything looks fine to me. But the program starts > slow when the loop number is >7.I wonder if recursion is the best when > the recursion number is >7? > > > Thanks, > > Li > > Does this do the same thing? hash_table=Hash.new(0) wordsize = 10 (0...4**wordsize).each do |f| hash_table[f.to_s(4).rjust(wordsize,"0").tr('0123','ACGT')] = f end p hash_table Harry -- A Look into Japanese Ruby List in English http://www.kakueki.com/ruby/list.html