Sorting algorithms/Insertion sort: Difference between revisions

m
→‎{{header|PL/I}}: A little more in the PL/I spirit
m (→‎{{header|PL/I}}: A little more in the PL/I spirit)
m (→‎{{header|PL/I}}: A little more in the PL/I spirit)
Line 1,954:
<lang pli>
INSSORT: PROC(A);
DCL A(*) FIXED BIN(31);
DCL (I, J, V, N, M) FIXED BIN(31);
 
N = HBOUND(A,1); M = LBOUND(A,1);
DO I=M+1 TO N;
V=A(I);
DO J=I-1 BY -1 WHILE (J > M-1 & A(J)>V);
IF A(J) <= V THEN LEAVE;
A(J+1)=A(J);
END;
1,392

edits