In essence, given 10 options, you are trying to create the Boolean Truth
table for any combination of 6 of them?
I'm not sure if you need recursion, just nested loops.
Something like this ( untested) should work for two lists:
<cfset MyList = "1,2 ,3, 4 ,5 ,6 ,7 ,8 ,9 ,10">
<cfloop list="MyList" item="Item1">
<cfset NextList = ReplaceList(Item, "",MyList)>
<cfoutput>Item1,</cfoutput>
<cfloop list="nextlist" item="item2">
<cfset NextList2 = ReplaceList(Item2, "",MyList)>
<cfoutput>Item2,</cfoutput>
</cfloop>
</cfloop>
And you just have more nested loops for each additional combination you need.
If you wanted to do a recursive approach, something along these lines
would probably work ( Untested, in algorithm form )
Function DisplayList (List, Item )
WriteOutput (Item);
NextList = ReplaceList(Item, "",MyList);
if NextList is ""{
Print Line Break
} else {
Loop over List {
DisplayList(NextList, Listitem)
}
}
At 02:55 PM 12/27/2002 +0800, you wrote:
>hihi.. anyone can help me..??
>
>
>given a list of numbers,
>eg: 1,2 ,3, 4 ,5 ,6 ,7 ,8 ,9 ,10
>
>the quantity of numbers in each group..
>eg: 6
>
>i suppose to output a list of grouping something like this
>eg:
>
>1,2,3,4,5,6
>1,2,3,4,5,7
>:
>:
>1,2,3,4,5,10
>1,3,4,5,6,7
>1,3,4,5,6,8
>:
>1,3,4,5,6,10
>:
>:
>1,6,7,8,9,10
>2,3,4,5,6,7
>:
>2,6,7,8,9,10
>3,4,5,6,7,8
>:
>:
>:
>5,6,7,8,9,10
>
>
>
>Numbers in each grp shld be in ASC order..
>There will be no repeating of numbers in each group.
>tried to do it with nested cfloop and list functions... but still cant get
>it... :(
>
>
>please show me some light if u r able to get it.. :)
>mail me direct, please ...;p
>
>
>thanx in advance... ;)
>han
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.