(no title)
NAR8789 | 2 years ago
1. Combine the first element with every next element until exhausted.
2. Catch up the second element to where the first element got to.
3. Combine the first two elements with every next element, until exhausted.
4. Catch up the third element.
5. Combine the first three elements with every next element
6. etc.
In pseudocode... n = 1
maxElementReached = -1
while(n < totalElements()) {
while(maxElementReached + 1 < totalElements()) {
maxElementReached = maxElementReached + 1
Combine each of the first n elements with element[maxElementReached]
}
// we've exhausted all possible combinations for the first n elements.
// increase n by 1 and catch up the new element to keep going
Combine element[n] with each element from n to maxElementReached
n = n + 1
}
No comments yet.