Sorting algorithms/Insertion sort: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: corrected a misspelling. -- ~~~~)
m (adding maxima)
Line 1,077: Line 1,077:


1 2 3 4 5 6</lang>
1 2 3 4 5 6</lang>

=={{header|Maxima}}==
<lang maxima>insertion_sort(u) := block(
[n: length(u), x, j],
for i from 2 thru n do (
x: u[i],
j: i - 1,
while j >= 1 and u[j] > x do (
u[j + 1]: u[j],
j: j - 1
),
u[j + 1]: x
)
)$</lang>


=={{header|Modula-3}}==
=={{header|Modula-3}}==