I don't know the type of this sort algortihm.
Captured from a message from Rony Flatscher in a public Internet
news group (see Internet - Newsgroups)
/* ------------------------------------------------------------------ */ /* function: sort routine */ /* */ /* call: sort */ /* */ /* returns: nothing */ /* */ /* notes: You must save the elements to sort in the stem "STEM." */ /* stem.0 must contain the number of elements in the stem. */ /* */ /* reference: Knuth, "Algorithms" */ /* */ Sort: PROCEDURE EXPOSE stem. /* define M for passes */ M = 1 do while (9 * M + 4) < stem.0 M = M * 3 + 1 end /* do while */ /* sort stem */ do while M > 0 K = stem.0 - M do J = 1 to K Q = J do while Q > 0 L = Q + M if stem.Q <<= stem.L then leave /* switch elements */ tmp = stem.Q stem.Q = stem.L stem.L = tmp Q = Q - M end /* do while Q > 0 */ end /* do J = 1 to K */ M = M % 3 end /* while M > 0 */ RETURN