Data structure for an ordered set with many defined subsets; retrieve subsets in same order

Posted by Aaron on Stack Overflow See other posts from Stack Overflow or by Aaron
Published on 2011-01-13T15:11:48Z Indexed on 2011/01/14 7:53 UTC
Read the original article Hit count: 184

I'm looking for an efficient way of storing an ordered list/set of items where:

  1. The order of items in the master set changes rapidly (subsets maintain the master set's order)
  2. Many subsets can be defined and retrieved
  3. The number of members in the master set grow rapidly
  4. Members are added to and removed from subsets frequently
  5. Must allow for somewhat efficient merging of any number of subsets

Performance would ideally be biased toward retrieval of the first N items of any subset (or merged subset), and storage would be in-memory (and maybe eventually persistent on disk)

© Stack Overflow or respective owner

Related posts about sorting

Related posts about data-structures