Pro SinkSort, tophandle swap = 1 pass = 0 last = 0 While swap NE 0 Do Begin handle1 = Handle_Info(tophandle, /First_Child) handle2 = Handle_Info(handle1, /Sibling) swap = 0 ;Do the comparisons While handle2 NE last Do Begin Handle_Value, handle1, current Handle_Value, handle2, next IF current GT next Then Begin Handle_Move, handle2, handle1, /Sibling swap = swap + 1 EndIF ELSE handle1=handle2 handle2 = Handle_Info(handle1, /Sibling) EndWhile last = handle1 pass = pass+1 EndWhile END