Sorting algorithms/Insertion sort: Difference between revisions

add swift
(Nimrod -> Nim)
(add swift)
Line 2,094:
while output = A<i>; i = ?lt(i,aSize) i + 1 :s(while)
end</lang>
=={{header|Swift}}==
Using generics.
<lang Swift>func insertionSort<T:Comparable>(inout list:[T]) {
for i in 1..<list.count {
var j = i
while j > 0 && list[j - 1] > list[j] {
(list[j], list[j - 1]) = (list[j - 1], list[j])
j--
}
}
}</lang>
 
=={{header|TI-83 BASIC}}==