[futurebasic] Re: Permutation Challenge

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2000 : Group Archive : Group : All Groups

From: lcs@...
Date: Thu, 30 Nov 2000 19:35:45 +0100 (MET)

Hi Jay,

Concerning your enumeration of the permutations of "0123456789"
you write:

 > Yes, this is recursion in a major way. Notice that the FN
 > calls itself not just twice, but anywhere from 2 to 10
 > times. 

You of course were talking about the recursion *depth* 
or *nesting* rather than the total number of calls.

As for total number:- there are *at most* 9 gCount incrementations 
per call so there are at least 10!/9 = 10*8! calls to your fn 
permutations. For string length N in place of 10 that is >= <no of 
perms>/(N-1) =N*(N-2)!.  Not bad! 

A recursion with a lot of depth is a RAM hog. 
A recursion with a lot of calls may be slow merely 
because of the calling overhead. But yours is probably 
plenty fast.

            Cheers

                   Larry S



PS.  Michael Kluskens tells me that Andy Prichard
was Godfather of that impressive macdev announcement.

PS. More Macdev gossip:
The OrangeUSB 2.0 Hi-Speed PCI Board outperforms the older
USB 1.1 by running up to 480 Mbits/s compared to the
standard 12 Mbits/s. <www.orangemicro.com>

Byebye firewire??