Bozo Sort

Two implementations are provided:

  • Pseudo code, and
  • A array-based implementation.

When compiled with the -O2 option, the array-based implementation sorts an array of size twelve in 10 seconds. The author did not have the patients to wait for a list of size thirteen.

Pseudo Code

To bozo sort an array:
	While the array is unsorted,
		Swap two randomly selected entries.
	end
end

Array-based Implementation

A straight-forward implementation of the pseudo code.