Classical algorithm - full array problem

Q: Output full array of three numbers 1, 2,
Import of java.util.ArrayList;
public class {the Main
static the ArrayList new new L = the ArrayList ();
// for checking whether there had been
static boolean [] b = new boolean [3];
// back
static void F (int [] a, int End) {//
// a termination condition is satisfied when the condition
IF (End == a.length) {
System.out.println ( L);
} the else {
number of cycles //
for (int I = 0; I <a.length; I ++) {
// determines whether used
iF (B [I]) {!
// record
l.add (a [I]);
// tag used
B [I] = to true;
// the next step
F (a, + End. 1);
// recovery: saving a state before the backtracking step results {}
l.remove (L. size () -. 1);
B [I] = to false;
}
}
}

}
Public static void main (String [] args) {
// cycle numbers
int [] = {l, 2,3} A;
F (A, 0);
}
}

Released three original articles · won praise 0 · Views 14

Guess you like

Origin blog.csdn.net/PROBIE_/article/details/104413135