Your requirements are quite unusual.
In place handling of huge datasets have been a theme of
BrowserUk's questions for a while now. They're interesting because they're things you generally wouldn't think twice about for small data sets, but in a resource constrained environment (time, memory) how you decide to do them can have a big effect on performance, or even solvability. It's kind of like going back to 1980 with a 1 Mhz machine with 16 kB of RAM and trying to do anything at all. Back in those days I once made a list of all the 4 letter combinations and stored them to disk, then printed them and discovered my printer was as fast as my floppy drive.