Lets say I have a dictionary:
{key1:value1........... keyn:valuen}
So lets say I want to write a function
def return_top_k(dictionary, k):
return list_of_keys_sorted
What is the most efficient way (in terms of big O) to get the keys which have the top k values (maintaining the order i.e the highest value key is present in the beginning.. and so on.)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…