Here are the requirements:
- Store objects that have multiple properties, including unique ID in addition to a Priority integer used for sorting.
- Priority will have duplicate values.
- Retrieval / checking for the existence of an object by its ID (i.e., Dictionary / Hashtable key) is O(1).
- Retrieval of "the top 10 items" by Priority must be as fast as possible. My assumption is this means there must be a separate List / LinkedList that keeps references to the items in the dictionary / hash table. If so, this List / LinkedList must be maintained whenever an item is added or removed, or an item's Priority value changes.
- Re-sorting the items upon adding / removing an item, or changing an item's Priority, is as fast as possible.
What data structure would you use? Does one already exist in .NET? Or should it be custom built? I'm leaning toward the latter.