File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -205,20 +205,20 @@ Algorithm.test("sorted/complexity") {
205
205
// Check performance of sort on array of repeating values
206
206
var comparisons_100 = 0
207
207
ary = [ Int] ( count: 100 , repeatedValue: 0 )
208
- ary. sortInPlace { comparisons_100++ ; return $0 < $1 }
208
+ ary. sortInPlace { comparisons_100 += 1 ; return $0 < $1 }
209
209
var comparisons_1000 = 0
210
210
ary = [ Int] ( count: 1000 , repeatedValue: 0 )
211
- ary. sortInPlace { comparisons_1000++ ; return $0 < $1 }
211
+ ary. sortInPlace { comparisons_1000 += 1 ; return $0 < $1 }
212
212
expectTrue ( comparisons_1000/ comparisons_100 < 20 )
213
213
214
214
// Try to construct 'bad' case for quicksort, on which the algorithm
215
215
// goes quadratic.
216
216
comparisons_100 = 0
217
217
ary = makeQSortKiller ( 100 )
218
- ary. sortInPlace { comparisons_100++ ; return $0 < $1 }
218
+ ary. sortInPlace { comparisons_100 += 1 ; return $0 < $1 }
219
219
comparisons_1000 = 0
220
220
ary = makeQSortKiller ( 1000 )
221
- ary. sortInPlace { comparisons_1000++ ; return $0 < $1 }
221
+ ary. sortInPlace { comparisons_1000 += 1 ; return $0 < $1 }
222
222
expectTrue ( comparisons_1000/ comparisons_100 < 20 )
223
223
}
224
224
You can’t perform that action at this time.
0 commit comments