List/map of key-value pairs backed up by file on disk?

The data structure that is "made" for your scenario is B-tree or its variants, like B+ tree.

Long and short of it: once you write things to disk you are not longer dealing with "data structures" - you are dealing with "serialization" and "databases. " The C++ STL and its data structures do not really address these issues, but, fortunately, they have already been addressed thousands of times by thousands of programmers already. Chances are 99.9% that they've already written something that will work well for you.

Based on your description, sqlite sounds like it would be a decent, balanced choice for your application.

Well, I'm aware of sqlite and similar libraries/projects, but I need to write this thing from scratch. So the question is how to do it. I simply need someone to point into the right direction, because solutions I've been able to think of so far aren't very elegant.

– SigTerm yesterday What you are doing isn't something that is simple to implement. To have good performance, concurrency, and larger-than-memory datasets, among other things, functioning well and bug-free you may be looking at more time to write your database from scratch than you were initially planning to spend on the project. If this is homework help, please tag it accordingly, if this isn't there shouldn't be a reason not to use tried-and-true libraries to help.

– sirbrialliance yesterday @SigTerm Why do you 'need' to write this from scratch? – Nick Johnson yesterday @sirbrilliance: Not homework (I wonder if there are people that give out homework like that) – SigTerm yesterday @Nick Johnson: "Why do you 'need' to write this from scratch? " I was asked to do it this way, it is job-related.

I can turn down the request if I want, though. I can probably write that thing anyway (won't be pretty, but it will work), but I asked the question because I thought that maybe I'm missing important piece of information and there's a well-known elegant way to do it. – SigTerm yesterday.

If you only need to do lookups (and insertions, deletions) by key, and not more complex field-based queries, BDB may be a better choice for your application.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions