Question d’entretien chez Scott Logic

what does this pseudocode do? (sorting algorithm) Three-Hat puzzle Mislabeled jars puzzle