maintaing a sorted list that is bigger than memory

Posted by tcurdt on Stack Overflow See other posts from Stack Overflow or by tcurdt
Published on 2010-05-31T14:37:35Z Indexed on 2010/05/31 14:43 UTC
Read the original article Hit count: 303

Filed under:
|
|
|

I have a list of tuples.

[
  "Bob": 3,
  "Alice: 2,
  "Jane": 1,
]

When incrementing the counts

 "Alice" += 2

the order should be maintained:

[
  "Alice: 4,
  "Bob": 3,
  "Jane": 1,
]

When all is in memory there rather simple ways (some more or some less) to efficiently implement this. (using an index, insert-sort etc) The question though is: What's the most promising approach when the list does not fit into memory.

Bonus question: What if not even the index fits into memory?

How would you approach this?

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about memory