I want to implement a hash table in python. In the table, the class object will be associated with the key value. The problem is that I want to use the key value to find the index of the class and update it (which, of course, is not a problem). But what should I do if I want to sort a table using a specific class value.
For example, consider we have three values: document_id, score, and rank. There is a class โdocumentโ, which consists of โratingโ and โrankโ. "document_id" will be the key element of the table.
I want to update the "rating" of various table entries using the key: "document_id". But when updating the results is complete, I want to sort the list / table using the rating and assign the rank value to the "rank" variable based on the updated rating.
Can someone kindly give me some recommendations on how I can proceed? Or maybe I just need to make a list?
The maximum number of table elements can be up to 25000-30000.
Thanks.
source share