Subj : Re: how to generate a sequence? To : comp.programming From : Steve O'Hara-Smith Date : Fri Sep 09 2005 03:01 pm On 8 Sep 2005 06:43:08 -0700 gswork@mailcity.com wrote: > > Neo wrote: > > > Well, for 4-5 symbols it was quick enough, but to ma surprise when I > > increase symbols to 9 damm.... it took 01 min 28.0954414 sec to exec and > > it process's mem usage was 216 MB !!!!!!!!!!!!!!!!!!!!! > > that'll be the recursion. A non recursive permutation algorithm would > help you for the constrained environment you mention (the 32kb one) I think not - a decent recursive algorithm for this problem only recurses to a depth matching the number of symbols being permuted. I coded one up in C just to try and it ran in 1.6 seconds on this box. Admittedly it went over 32K - but so does the hello world program :) ISTR using the same algorithm on boxes with much less than 32K many years ago when I was doing CS homework :) -- C:>WIN | Directable Mirror Arrays The computer obeys and wins. | A better way to focus the sun You lose and Bill collects. | licences available see | http://www.sohara.org/ .