Infosys Interview Question

It was based on sorting and graphs.