Thoughtworks interview question

Algorithm implementation for sort logic