Jump to content

Sorting algorithms/Insertion sort: Difference between revisions

GP
(GP)
Line 915:
{InsertionSort Arr}
{Show {Array.toRecord unit Arr}}</lang>
 
=={{header|PARI/GP}}==
<lang parigp>insertionSort(v)={
for(i=1,#v-1,
my(j=i-1,x=v[i]);
while(j && v[j]>x,
v[j+1]=v[j];
j--
);
v[j+1]=x
);
v
};</lang>
 
=={{header|Perl}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.