Find combinations in k-subsets
- To: mathgroup at smc.vnet.net
- Subject: [mg14089] Find combinations in k-subsets
- From: "Carlos Carreto" <ccarreto at ipg.pt>
- Date: Fri, 25 Sep 1998 03:15:17 -0400
- Sender: owner-wri-mathgroup at wolfram.com
I would like to solve the following problem: Having k-subsets given in lexicographic order as input: {1,2,3},{1,2,4},{1,2,5},{1,2,6},{1,3,4},{1,3,5},{1,3,6},{1,4,6}, {2,3,4},{2,3,6},{2,4,6},{3,4,6} I would like to determine the possible combinations. In this case the k-subsets: {1,2,3},{1,2,4},{1,2,6},{1,3,4},{1,3,6},{1,4,6},{2,3,4}, {2,3,6},{2,4,6},{3,4,6} correspond to the combination: [{1, 2, 3, 4, 6}, 3] and there are two remaining k-subsets: {1,2,5} and {1,3,5} This is more or less the opposite of the function KSubsets[ ]. Is there any function to do this? Can you think of an efficient algorithm? Thank you for your help -:- Carlos