Sorting algorithms/Comb sort: Difference between revisions

Content added Content deleted
m (→‎{{header|ALGOL 68}}: no point sorting a single-element array)
Line 502: Line 502:
PROC comb sort = ( REF[]INT input )VOID:
PROC comb sort = ( REF[]INT input )VOID:
IF INT input size = ( UPB input - LWB input ) + 1;
IF INT input size = ( UPB input - LWB input ) + 1;
input size > 0
input size > 1
THEN # non-empty array, so must sort #
THEN # more than one element, so must sort #
INT gap := input size; # initial gap is the whole array size #
INT gap := input size; # initial gap is the whole array size #
BOOL swapped := TRUE;
BOOL swapped := TRUE;