The sorting algorithm your mother warned you about