On Tue, Oct 01, 2002 at 02:01:53PM -0700, david wrote:
> i found your problem insteresting! the following should solve it:
Well in that case, please hand this one in for me.
perl -e'*,=sub{print+local$*=$*.$_[$_],$/,&,(@_[1+$_..$#_])for$#..$#_};&,(1..5)'
Different algorithm, different results,
Yannik Lefebvre wrote:
> Exemple: i have a list of numbers ( 1 - 2 - 3 - 4 -5)
>
> i need to find all possible combination from that list
>
> 1
> 12
> 123
> 1234
> 12345
> 13
> 134
> 1345
>
> etc
>
> Thank u all!
i found your problem insteresting! the following should solve it:
#!/usr/b
This looks like homework, but I'll give you a (one of many, I'd guess)
pseudocode solution:
sub print_combos(str,list) { # note -- PSEUDOCODE
if (empty(list)) {
# if (str != "") # do you want the empty list as an output?
print str;
} else {
x = pop list; #remove an element
So me what you've tried and I will be more than happy to help you fix
it.
James Gray
On Tuesday, October 1, 2002, at 02:33 PM, Yannik Lefebvre wrote:
> Exemple: i have a list of numbers ( 1 - 2 - 3 - 4 -5)
>
> i need to find all possible combination from that list
>
> 1
> 12
> 123
> 1234
> 12
On Tue, Oct 01, 2002 at 03:33:42PM -0400, Yannik Lefebvre wrote:
> Exemple: i have a list of numbers ( 1 - 2 - 3 - 4 -5)
>
> i need to find all possible combination from that list
>
> 1
> 12
> 123
> 1234
> 12345
> 13
> 134
> 1345
>
> etc
Are you having problems with the Perl or the algori