Cheap and Secure Web Hosting Provider : See Now

Selection type generated by nested loops where initial value is current value of parent loop

, , No Comments
Problem Detail: 

Consider the generator of the selections:

for (i1 = 0;  i1 < 10; i1++)     for (i2 = i1; i2 < 10; i2++)         for (i3 = i2; i3 < 10; i3++)             for (i4 = i3; i4 < 10; i4++)                 printf("%d%d%d%d", i1, i2, i3, i4); 

Result:

0000 0001 0002 ... 0009 0011 <-- 0010 is skipped 0012 ... 0019 0022 <-- 0020 and 0021 are skipped 0023 ... 8999 9999 

Generated selections have the following property: the order in the selection does not mater, i.e. 0011 0101 1001 1010 1100 are the same.

Basically it is 4-combination of the set { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, ..., 9, 9, 9, 9}

What do you say to name this type of the selection?

I always get stuck when I say:

4-xxxxxxxx of the set {0, 1, 2, ..., 9} 

where xxxxxxxx is the name of this selection.

Asked By : Alvin
Answered By : David Richerby

The sequences your program generates are non-decreasing sequences.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/33196

3200 people like this

 Download Related Notes/Documents

0 comments:

Post a Comment

Let us know your responses and feedback