Skip to content

Commit 0e83ef2

Browse files
committed
removed duplicate implementation
1 parent b90632c commit 0e83ef2

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

Bubble Sort/MyPlayground.playground/Contents.swift

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
import Foundation
22

3-
public func BubbleSort<T> (_ elements: [T]) -> [T] where T: Comparable {
4-
var array = elements
5-
6-
for i in 0..<array.count {
7-
for j in 1..<array.count-i {
8-
print(array,"comparing [\(j-1)] with [\(j)]")
9-
if array[j] < array[j-1] {
10-
let tmp = array[j-1]
11-
array[j-1] = array[j]
12-
array[j] = tmp
13-
}
14-
}
15-
}
16-
17-
return array
18-
}
19-
203
var array = [4,2,1,3]
214

225
print("before:",array)

0 commit comments

Comments
 (0)