# PIKSRT - Straight insertion of sorting, this is most efficient for sorting # samples less than about 50. Adapted from Numerical Recipes by Press et. al. # (1986), p.227. procedure piksrt (arr, n) real arr[*] # input/output: sample array, sorted into # ascending order on output int n # number of samples int i, j real a #============================================================================== begin do j = 2, n { a = arr[j] do i = j-1, 1, -1 { if (arr[i] <= a) goto 10 arr[i+1] = arr[i] } i = 0 10 arr[i+1] = a } end