We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 98c0d55 + d01fb8d commit f144470Copy full SHA for f144470
Bubble Sort/README.markdown
@@ -57,9 +57,9 @@ This is the same for the forth and fifth passes.
57
```swift
58
for i in 0..<array.count {
59
for j in 1..<array.count {
60
- if array[j] < array[i] {
61
- let tmp = array[i]
62
- array[i] = array[j]
+ if array[j] < array[j-1] {
+ let tmp = array[j-1]
+ array[j-1] = array[j]
63
array[j] = tmp
64
}
65
@@ -73,9 +73,9 @@ The bubble sort algorithm can be easily optimized by observing that the `n-th` p
73
74
75
for j in 1..<array.count - i {
76
77
78
79
80
81
0 commit comments