Infosys interview question

It was based on sorting and graphs.