Próbuję przepisac bubble sorta do swifta i rzuca mi taki error
main.swift:19:28: error: missing argument labels 'tablica:amount:' in call
var sortResult = bubbleSort(tablica, amount)
Co robię źle?
Template:
procedure bubbleSort( A : lista elementów do posortowania )
n = liczba_elementów(A)
do
for (i = 0; i < n-1; i++) do:
if A[i] > A[i+1] then
swap(A[i], A[i+1])
end if
end for
n = n-1
while n > 1
end procedure
Swift:
func bubbleSort(tablica:[Int], amount:Int) {
var n = amount
repeat {
for i in 0...tablica.count - 1 {
if tablica[i] > tablica[i+1] {
}
}
} while n > 1
}
var tablica = [1,2,3,4,6]
var amount = 6
var sortResult = bubbleSort(tablica, amount)
print(sortResult)