Pergunta de entrevista da empresa Oracle

Sorting algorithm question where I had to make a basic function in any language i preferred.