Sorting algorithms/Counting sort: Difference between revisions

(→‎{{header|Perl 6}}: Use a better comparison for the test)
Line 660:
integer :: i, z
 
cnt = 0 ! Initialize to zero to prevent false counts
forall(i=tmin:tmax)
FORALL (I=1:Z) ! Not sure that this gives any benefit over a DO loop.
cnt(array(i)) = countcnt(array == (i))+1
end forall
END FORALL
 
!
! ok - cnt contains the frequency of every value
! let's unwind them into the original array
!
z = 1
do i = tmin, tmax