Infosys Interview Question

Prepare a logic of sorting