I have 7 elements and I want to list all subsets of size 4 ie: 7C4=35 so i want to explicitly list the 35 elements, does anyone know an method for doing this?
Follow Math Help Forum on Facebook and Google+
I think the following algorithm should work. Code: for x1 = 1 to 7 for x2 = x1 + 1 to 7 for x3 = x2 + 1 to 7 for x4 = x3 + 1 to 7 print x1, x2, x3, x4
for x1 = 1 to 7 for x2 = x1 + 1 to 7 for x3 = x2 + 1 to 7 for x4 = x3 + 1 to 7 print x1, x2, x3, x4
View Tag Cloud