Alexander said:
Yes, first thing I want is to allocate dynamically a few mb's of
memory, and find a good way to convince the user to wait for the
allocation in case the program evem succeeds.
I don't get it. Are you possibly talking about some embedded or
hand-held system with a few tens of kilobytes of RAM, or something?
I have made programs for the iPhone which use full-sized English (and
other language) dictionaries. Loading the dictionary into memory takes
a fraction of a second (even though the dictionary data is actually
*compressed* in the flash drive, so there's a decompression to memory
involved; it still takes just a fraction of a second).
On a desktop computer you could probably load such a dictionary into
memory an order of magnitude faster (not to talk that its size in memory
is inconsequential because desktop computers have typically at least an
order of magnitude more RAM avilable for apps than the iPhone).
Loading and using a full dictionary isn't such a heavy operation in
modern systems (even hand-held ones).
I wanted to know what the practice is - it is quite common, but not
neccesairily trivial - even without storing the file in memory
(stupid) I have to find some quick enough algorithm to search for a
given word in it.
Binary search is the simplest (especially in C++ because the standard
library offers it) and certainly fast enough.