Sorting algorithms/Insertion sort: Difference between revisions

Line 458:
 
=={{header|Fortran}}==
In ANSI FORTRAN 77 and above with MIL-STD 1753 extensions, use structured DO and DO WHILE loops
<lang fortran>SUBROUTINE Insertion_Sort(a)
REAL, INTENT(in out), DIMENSION(:) :: a
Line 473 ⟶ 474:
END DO
END SUBROUTINE Insertion_Sort</lang>
In ISO Fortran 90 and above the intrinsic function CSHIFT can be used to shift the elements in the array but in practice is slower than the above example
<lang fortran>DO i = 2, SIZE(a)
j = i - 1
Anonymous user