I am wondering what the most efficient tree structure would be for a collection that has the following requirements:
The tree structure must support efficient insertions and deletions, as well as a quick search by unique identifier. Also, finding the first available unused unique identifier should be a quick operation.
Which tree is best suited for these requirements?
EDIT: this tree will only be stored in memory; in no case will it be saved to disk. I don’t need to worry about getting to disk, disk caching or anything like that. That is why I am not looking for something like SQLite.
- trie? , , - , .
, , , , , .
, , , mmap-ed . . , , . 1 2 ( ). , .
, , , .
: " "
, 2 ^ 32 ( , ), , , . - . , , , . mmap ( - ) , , , .
, ( , mmap B- Black-Red - ), . , . , B-tree ( ), , ( ) ( LRU), , .
: , . , 10 ^ -9 10 ^ -3. 1 . TANSTAAFL!
- , , //. AVL , , .
http://en.wikipedia.org/wiki/Red-black_tree
http://en.wikipedia.org/wiki/AVL_tree
, , , stl. , , , , , - , . , , , .. .
AVL, . AVL , , , .
, 2 ^ 32-1 ? SQLite. , , , . , .
, BTree. - , , .
, , , . , . , .
boost::unordered_map , . , .
boost::unordered_map
, , , , . , , , -. , boost boost: hash function. , ; .
(: , -, "". , , - ( )?)
?
, . , - .
. (2 ^ 32 ), 4 8 . , .
32- , , . ?
, . . , -. , , . 512 , .
, . , , , node . memset(), node. , node. node, . node, , , . ( node, , node -.)
memset()
It will probably take about 64 GB or 96 GB of RAM, but this is less than the solution of the card.
Source: https://habr.com/ru/post/1725233/More articles:TIFF multi-page image splitting - with .NET and IronPython - splitHow can I sign an OSGi package with Ant without overwriting the contents of MANIFEST.MF? - javajava different sorting methods for one dataset - javaResize checkbox in Flex - flexразница между параметрами -h и -o в cc (С++) - c++How to fill in blanks in a date in MySQL? - sqlWhat is a test management template - unit-testingDjango 1.1 - comments - 'render_comment_form' returns TemplateSyntaxError - pythonPrologue - recursive family tree - treeUpdating a configuration file using classic ASP - fileAll Articles