File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
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 var index in 0 ..< arr . count{
17
+ for var 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
-
27
- while arr [ index - 1 ] > arr [ index] && index - 1 > 0 {
28
- swap ( & arr [ index - 1 ] , & arr [ index] )
26
+
27
+ while list [ index - 1 ] > list [ index] && index - 1 > 0 {
28
+ swap ( & list [ index - 1 ] , & list [ index] )
29
29
index -= 1
30
30
}
31
31
}
You can’t perform that action at this time.
0 commit comments