Question d’entretien chez Microsoft

Solve the ball sorting algorithm and explain it.