class LAMPSORT [G -> COMPARABLE] General cluster: lampsort description: "Quicksort according to Lamport/Meyer. The Lampsort algorithm is a simple loop; it does not use recursion, but relies on an interesting data structure, a set of intervals. It is hardly more difficult to understand, and hardly shorter, than the traditional recursive version. the recursive version, and its parallelized variants, are only examples of possible implementations" create: make Ancestors ANY Queries a: ARRAY [G] permutation (a1, a2: [like a] ARRAY [G]): BOOLEAN picked: INTEGER_INTERVAL pivot1: INTEGER_32 pivot2: INTEGER_32 Commands lampsort (i, j: INTEGER_32) make (l_a: [like a] ARRAY [G]) partition (i, j: INTEGER_32) sort sort2 sort_recursive (i, j: INTEGER_32) swap (m, n: INTEGER_32)
Generated by ISE EiffelStudio