Generating all possible combinations
Posted 03 June 2012 - 04:49 PM
I want to generate all possible combinations from a set of n numbers and
want to exclude the combinations with hold two consecutive numbers.
I just want to generate
Is there any smart way of doing this other than generating all combinations first and
removing the unwanted ones?
Thanks in advance
Posted 04 June 2012 - 03:04 AM
Posted 04 June 2012 - 08:07 AM
Posted 04 June 2012 - 08:41 AM
Or did you mean something else?
Perhaps you could show us how you would implement it in the naïve way?
Posted 04 June 2012 - 04:05 PM
The same approach should still work. Generalizing it to size n is left as an exercise for the reader.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users