saving Btrees to a disk file and read it

后端 未结 4 1087
后悔当初
后悔当初 2020-12-03 06:32

I want to save a Btree(not sure a binary one) in a disk file. and then read it to the memory. some Level-order traversal may be a good way for a binary Btree. but if it is n

4条回答
  •  再見小時候
    2020-12-03 06:45

    The usual technique for B-Trees is to ensure that the size of a node is equal to the block size of the disk, and mmap the disk file. You don't specify what programming language you're working in, so it might be as simple as a cast in C, or something more complicated such as creating flyweight objects to wrap up a java.nio.IntBuffer. Either way, much of the advantage of the B-tree is that you don't have to load it all at once, but can jump around it fairly efficiently.

提交回复
热议问题