Given a huge list of Investors with id, name, net worth, etc. Write an efficient code for printing top k investors in the list.
For example, if given list is -
[Investor A:(networth:20L),
Investor B:(networth:25L),
Investor C:(networth:10L),
Investor D:(networth:50L),
Investor E:(networth:30L)]
and you are asked for the largest 3 investors i.e., k = 3 then your program should display Investors D, E and B data.
Aucun commentaire:
Enregistrer un commentaire