Fundamental Algorithm Analysis
Head Permutations Using a Linear Array of 5 Letters
EXAMPLE_01 Output where N = 5
Sequence |
Output |
Indexes Swapped |
1 |
A B C D E |
No Swap |
2 |
B A C D E |
swapped(0, 1) |
3 |
C A B D E |
swapped(0, 2) |
4 |
A C B D E |
swapped(0, 1) |
5 |
B C A D E |
swapped(0, 2) |
6 |
C B A D E |
swapped(0, 1) |
7 |
C B D A E |
swapped(2, 3) |
8 |
B C D A E |
swapped(0, 1) |
9 |
D C B A E |
swapped(0, 2) |
10 |
C D B A E |
swapped(0, 1) |
11 |
B D C A E |
swapped(0, 2) |
12 |
D B C A E |
swapped(0, 1) |
13 |
D A C B E |
swapped(1, 3) |
14 |
A D C B E |
swapped(0, 1) |
15 |
C D A B E |
swapped(0, 2) |
16 |
D C A B E |
swapped(0, 1) |
17 |
A C D B E |
swapped(0, 2) |
18 |
C A D B E |
swapped(0, 1) |
19 |
B A D C E |
swapped(0, 3) |
20 |
A B D C E |
swapped(0, 1) |
21 |
D B A C E |
swapped(0, 2) |
22 |
B D A C E |
swapped(0, 1) |
23 |
A D B C E |
swapped(0, 2) |
24 |
D A B C E |
swapped(0, 1) |
25 |
E A B C D |
swapped(0, 4) |
26 |
A E B C D |
swapped(0, 1) |
27 |
B E A C D |
swapped(0, 2) |
28 |
E B A C D |
swapped(0, 1) |
29 |
A B E C D |
swapped(0, 2) |
30 |
B A E C D |
swapped(0, 1) |
31 |
B A C E D |
swapped(2, 3) |
32 |
A B C E D |
swapped(0, 1) |
33 |
C B A E D |
swapped(0, 2) |
34 |
B C A E D |
swapped(0, 1) |
35 |
A C B E D |
swapped(0, 2) |
36 |
C A B E D |
swapped(0, 1) |
37 |
C E B A D |
swapped(1, 3) |
38 |
E C B A D |
swapped(0, 1) |
39 |
B C E A D |
swapped(0, 2) |
40 |
C B E A D |
swapped(0, 1) |
41 |
E B C A D |
swapped(0, 2) |
42 |
B E C A D |
swapped(0, 1) |
43 |
A E C B D |
swapped(0, 3) |
44 |
E A C B D |
swapped(0, 1) |
45 |
C A E B D |
swapped(0, 2) |
46 |
A C E B D |
swapped(0, 1) |
47 |
E C A B D |
swapped(0, 2) |
48 |
C E A B D |
swapped(0, 1) |
49 |
D E A B C |
swapped(0, 4) |
50 |
E D A B C |
swapped(0, 1) |
51 |
A D E B C |
swapped(0, 2) |
52 |
D A E B C |
swapped(0, 1) |
53 |
E A D B C |
swapped(0, 2) |
54 |
A E D B C |
swapped(0, 1) |
55 |
A E B D C |
swapped(2, 3) |
56 |
E A B D C |
swapped(0, 1) |
57 |
B A E D C |
swapped(0, 2) |
58 |
A B E D C |
swapped(0, 1) |
59 |
E B A D C |
swapped(0, 2) |
60 |
B E A D C |
swapped(0, 1) |
61 |
B D A E C |
swapped(1, 3) |
62 |
D B A E C |
swapped(0, 1) |
63 |
A B D E C |
swapped(0, 2) |
64 |
B A D E C |
swapped(0, 1) |
65 |
D A B E C |
swapped(0, 2) |
66 |
A D B E C |
swapped(0, 1) |
67 |
E D B A C |
swapped(0, 3) |
68 |
D E B A C |
swapped(0, 1) |
69 |
B E D A C |
swapped(0, 2) |
70 |
E B D A C |
swapped(0, 1) |
71 |
D B E A C |
swapped(0, 2) |
72 |
B D E A C |
swapped(0, 1) |
73 |
C D E A B |
swapped(0, 4) |
74 |
D C E A B |
swapped(0, 1) |
75 |
E C D A B |
swapped(0, 2) |
76 |
C E D A B |
swapped(0, 1) |
77 |
D E C A B |
swapped(0, 2) |
78 |
E D C A B |
swapped(0, 1) |
79 |
E D A C B |
swapped(2, 3) |
80 |
D E A C B |
swapped(0, 1) |
81 |
A E D C B |
swapped(0, 2) |
82 |
E A D C B |
swapped(0, 1) |
83 |
D A E C B |
swapped(0, 2) |
84 |
A D E C B |
swapped(0, 1) |
85 |
A C E D B |
swapped(1, 3) |
86 |
C A E D B |
swapped(0, 1) |
87 |
E A C D B |
swapped(0, 2) |
88 |
A E C D B |
swapped(0, 1) |
89 |
C E A D B |
swapped(0, 2) |
90 |
E C A D B |
swapped(0, 1) |
91 |
D C A E B |
swapped(0, 3) |
92 |
C D A E B |
swapped(0, 1) |
93 |
A D C E B |
swapped(0, 2) |
94 |
D A C E B |
swapped(0, 1) |
95 |
C A D E B |
swapped(0, 2) |
96 |
A C D E B |
swapped(0, 1) |
97 |
B C D E A |
swapped(0, 4) |
98 |
C B D E A |
swapped(0, 1) |
99 |
D B C E A |
swapped(0, 2) |
100 |
B D C E A |
swapped(0, 1) |
101 |
C D B E A |
swapped(0, 2) |
102 |
D C B E A |
swapped(0, 1) |
103 |
D C E B A |
swapped(2, 3) |
104 |
C D E B A |
swapped(0, 1) |
105 |
E D C B A |
swapped(0, 2) |
106 |
D E C B A |
swapped(0, 1) |
107 |
C E D B A |
swapped(0, 2) |
108 |
E C D B A |
swapped(0, 1) |
109 |
E B D C A |
swapped(1, 3) |
110 |
B E D C A |
swapped(0, 1) |
111 |
D E B C A |
swapped(0, 2) |
112 |
E D B C A |
swapped(0, 1) |
113 |
B D E C A |
swapped(0, 2) |
114 |
D B E C A |
swapped(0, 1) |
115 |
C B E D A |
swapped(0, 3) |
116 |
B C E D A |
swapped(0, 1) |
117 |
E C B D A |
swapped(0, 2) |
118 |
C E B D A |
swapped(0, 1) |
119 |
B E C D A |
swapped(0, 2) |
120 |
E B C D A |
swapped(0, 1) |
Click here to return to EXAMPLE_01 - Alpha.