data structures - C# Priority List -
i'm having trouble finding right c# data structure. i'm looking prioritylist. needs have following:
- only 1 item given priority
- must remain sorted @ times
- ability add item end of list -- proritylist.add(item)
- ability insert item @ given priority -- prioritylist.add(3, item)
- ability access element using priority -- prioritylist[3]
- ability remove item @ given priority -- prioritylist.removeat(3)
- when item added or removed, rest of list must shift or down appropriately -- example, if third item removed, fourth item becomes third item, fifth item becomes fourth item, etc.
c#'s sortedlist looked promising, can't handle inserting @ priority exists or removing element @ given priority (having list shift appropriately in both cases).
if use standard list<t>
should give have asked if use priority == index.
Comments
Post a Comment