Sorting algorithms/Insertion sort: Difference between revisions
Sorting algorithms/Insertion sort (view source)
Revision as of 20:39, 6 September 2012
, 11 years agoadding maxima
m (→{{header|REXX}}: corrected a misspelling. -- ~~~~) |
Capra Hircus (talk | contribs) m (adding maxima) |
||
Line 1,077:
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}}==
|