Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,17 @@
|
|||
func bubbleSort<T:Comparable>(list:inout[T]) {
|
||||
var done = false
|
||||
while !done {
|
||||
done = true
|
||||
for i in 1..<list.count {
|
||||
if list[i - 1] > list[i] {
|
||||
(list[i], list[i - 1]) = (list[i - 1], list[i])
|
||||
done = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var list1 = [3, 1, 7, 5, 2, 5, 3, 8, 4]
|
||||
print(list1)
|
||||
bubbleSort(list: &list1)
|
||||
print(list1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue