File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -14,18 +14,18 @@ public func shellSort(_ list : inout [Int])
14
14
15
15
while sublistCount > 0
16
16
{
17
- for index in 0 ..< arr . count{
17
+ for index in 0 ..< list . count{
18
18
19
- guard index + sublistCount < arr . count else { break }
19
+ guard index + sublistCount < list . count else { break }
20
20
21
- if arr [ index] > arr [ index + sublistCount] {
22
- swap ( & arr [ index] , & arr [ index + sublistCount] )
21
+ if list [ index] > list [ index + sublistCount] {
22
+ swap ( & list [ index] , & list [ index + sublistCount] )
23
23
}
24
24
25
25
guard sublistCount == 1 && index > 0 else { continue }
26
26
27
- if arr [ index - 1 ] > arr [ index] {
28
- swap ( & arr [ index - 1 ] , & arr [ index] )
27
+ if list [ index - 1 ] > list [ index] {
28
+ swap ( & list [ index - 1 ] , & list [ index] )
29
29
}
30
30
}
31
31
sublistCount = sublistCount / 2
You can’t perform that action at this time.
0 commit comments