Sorting algorithms/Insertion sort: Difference between revisions

(→‎{{header|MATLAB}}: works fine with Octave, too. Verified with Octave 3.4.3)
Line 915:
 
print(unpack(isort{4,5,2,7,8,3}))</lang>
 
=={{header|Mathematica}}==
<lang Mathematica>insertionSort[A_List] :=
For[ i = 2, i < Length[A], i++,
value = A[[i]]; j = i - 1;
While[ j >= 1 && A[[j]] > value , A[[j + 1]] = A[[j]]; j--;];
A[[j + 1]] = value;
];</lang>
 
=={{header|MATLAB}} / {{header|Octave}}==