-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelectionSorting.log
192 lines (186 loc) · 7.37 KB
/
SelectionSorting.log
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# Log for Test short unsorted list arrlist = [10,4,8,6,1]
Length of the Input Array : 5
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 1 starting array is [10, 4, 8, 6, 1]
comparing 10 and 4
comparing 4 and 8
comparing 4 and 6
comparing 4 and 1
Swapping the number 1 >> for the number 10
Current Array after swap : [1, 4, 8, 6, 10]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 2 starting array is [1, 4, 8, 6, 10]
comparing 4 and 8
comparing 4 and 6
comparing 4 and 10
>>> Looks like value is sorted. No Swap is performed >>>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 3 starting array is [1, 4, 8, 6, 10]
comparing 8 and 6
comparing 6 and 10
Swapping the number 6 >> for the number 8
Current Array after swap : [1, 4, 6, 8, 10]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 4 starting array is [1, 4, 6, 8, 10]
comparing 8 and 10
>>> Looks like value is sorted. No Swap is performed >>>
Total iterations :4 Total Comparisons : 10 Output Array is : [1, 4, 6, 8, 10]
[1, 4, 6, 8, 10]
---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*
# Log for Test long unsorted list arrlist = [3, 56, 2, 58, 79, 59, 34, 23, 4, 78, 8, 123, 45]
Length of the Input Array : 13
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 1 starting array is [3, 56, 2, 58, 79, 59, 34, 23, 4, 78, 8, 123, 45]
comparing 3 and 56
comparing 3 and 2
comparing 2 and 58
comparing 2 and 79
comparing 2 and 59
comparing 2 and 34
comparing 2 and 23
comparing 2 and 4
comparing 2 and 78
comparing 2 and 8
comparing 2 and 123
comparing 2 and 45
Swapping the number 2 >> for the number 3
Current Array after swap : [2, 56, 3, 58, 79, 59, 34, 23, 4, 78, 8, 123, 45]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 2 starting array is [2, 56, 3, 58, 79, 59, 34, 23, 4, 78, 8, 123, 45]
comparing 56 and 3
comparing 3 and 58
comparing 3 and 79
comparing 3 and 59
comparing 3 and 34
comparing 3 and 23
comparing 3 and 4
comparing 3 and 78
comparing 3 and 8
comparing 3 and 123
comparing 3 and 45
Swapping the number 3 >> for the number 56
Current Array after swap : [2, 3, 56, 58, 79, 59, 34, 23, 4, 78, 8, 123, 45]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 3 starting array is [2, 3, 56, 58, 79, 59, 34, 23, 4, 78, 8, 123, 45]
comparing 56 and 58
comparing 56 and 79
comparing 56 and 59
comparing 56 and 34
comparing 34 and 23
comparing 23 and 4
comparing 4 and 78
comparing 4 and 8
comparing 4 and 123
comparing 4 and 45
Swapping the number 4 >> for the number 56
Current Array after swap : [2, 3, 4, 58, 79, 59, 34, 23, 56, 78, 8, 123, 45]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 4 starting array is [2, 3, 4, 58, 79, 59, 34, 23, 56, 78, 8, 123, 45]
comparing 58 and 79
comparing 58 and 59
comparing 58 and 34
comparing 34 and 23
comparing 23 and 56
comparing 23 and 78
comparing 23 and 8
comparing 8 and 123
comparing 8 and 45
Swapping the number 8 >> for the number 58
Current Array after swap : [2, 3, 4, 8, 79, 59, 34, 23, 56, 78, 58, 123, 45]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 5 starting array is [2, 3, 4, 8, 79, 59, 34, 23, 56, 78, 58, 123, 45]
comparing 79 and 59
comparing 59 and 34
comparing 34 and 23
comparing 23 and 56
comparing 23 and 78
comparing 23 and 58
comparing 23 and 123
comparing 23 and 45
Swapping the number 23 >> for the number 79
Current Array after swap : [2, 3, 4, 8, 23, 59, 34, 79, 56, 78, 58, 123, 45]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 6 starting array is [2, 3, 4, 8, 23, 59, 34, 79, 56, 78, 58, 123, 45]
comparing 59 and 34
comparing 34 and 79
comparing 34 and 56
comparing 34 and 78
comparing 34 and 58
comparing 34 and 123
comparing 34 and 45
Swapping the number 34 >> for the number 59
Current Array after swap : [2, 3, 4, 8, 23, 34, 59, 79, 56, 78, 58, 123, 45]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 7 starting array is [2, 3, 4, 8, 23, 34, 59, 79, 56, 78, 58, 123, 45]
comparing 59 and 79
comparing 59 and 56
comparing 56 and 78
comparing 56 and 58
comparing 56 and 123
comparing 56 and 45
Swapping the number 45 >> for the number 59
Current Array after swap : [2, 3, 4, 8, 23, 34, 45, 79, 56, 78, 58, 123, 59]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 8 starting array is [2, 3, 4, 8, 23, 34, 45, 79, 56, 78, 58, 123, 59]
comparing 79 and 56
comparing 56 and 78
comparing 56 and 58
comparing 56 and 123
comparing 56 and 59
Swapping the number 56 >> for the number 79
Current Array after swap : [2, 3, 4, 8, 23, 34, 45, 56, 79, 78, 58, 123, 59]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 9 starting array is [2, 3, 4, 8, 23, 34, 45, 56, 79, 78, 58, 123, 59]
comparing 79 and 78
comparing 78 and 58
comparing 58 and 123
comparing 58 and 59
Swapping the number 58 >> for the number 79
Current Array after swap : [2, 3, 4, 8, 23, 34, 45, 56, 58, 78, 79, 123, 59]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 10 starting array is [2, 3, 4, 8, 23, 34, 45, 56, 58, 78, 79, 123, 59]
comparing 78 and 79
comparing 78 and 123
comparing 78 and 59
Swapping the number 59 >> for the number 78
Current Array after swap : [2, 3, 4, 8, 23, 34, 45, 56, 58, 59, 79, 123, 78]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 11 starting array is [2, 3, 4, 8, 23, 34, 45, 56, 58, 59, 79, 123, 78]
comparing 79 and 123
comparing 79 and 78
Swapping the number 78 >> for the number 79
Current Array after swap : [2, 3, 4, 8, 23, 34, 45, 56, 58, 59, 78, 123, 79]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 12 starting array is [2, 3, 4, 8, 23, 34, 45, 56, 58, 59, 78, 123, 79]
comparing 123 and 79
Swapping the number 79 >> for the number 123
Current Array after swap : [2, 3, 4, 8, 23, 34, 45, 56, 58, 59, 78, 79, 123]
Total iterations :12 Total Comparisons : 78 Output Array is : [2, 3, 4, 8, 23, 34, 45, 56, 58, 59, 78, 79, 123]
[2, 3, 4, 8, 23, 34, 45, 56, 58, 59, 78, 79, 123]
---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*
# Log for Test Sorted list arrlist = [1,2,3,4,5,6]
Length of the Input Array : 5
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 1 starting array is [1, 2, 3, 4, 5]
comparing 1 and 2
comparing 1 and 3
comparing 1 and 4
comparing 1 and 5
>>> Looks like value is sorted. No Swap is performed >>>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 2 starting array is [1, 2, 3, 4, 5]
comparing 2 and 3
comparing 2 and 4
comparing 2 and 5
>>> Looks like value is sorted. No Swap is performed >>>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 3 starting array is [1, 2, 3, 4, 5]
comparing 3 and 4
comparing 3 and 5
>>> Looks like value is sorted. No Swap is performed >>>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Iteration : 4 starting array is [1, 2, 3, 4, 5]
comparing 4 and 5
>>> Looks like value is sorted. No Swap is performed >>>
Total iterations :4 Total Comparisons : 10 Output Array is : [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5]