This code prints a combination of elements present in an array "pts" (4 elements at a time) in such a way that a particular combination of digits never occurs more than once. Eg. If 1 2 3 4 is printed already then none of its permutations should get printed.
for (int i = 0; i < pts.length; i++) {
for (int j = i+1; j < pts.length; j++) {
for (int k = j+1; k < pts.length; k++) {
for (int l = k+1; l < pts.length; l++) {
System.out.println(""+pts[i]+" "+pts[j]+" "+pts[k]+" "+pts[l]);
}
}
}
}
If anyone can suggest some other approach or can tell me how to reduce this code's complexity. I shall be thankful
ptsarray. Is this intended?