-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Kurt Krueckeberg edited this page Apr 22, 2018
·
2 revisions
The complete source code is at https://github.com/kkruecke/23tree-in-cpp
The following sources discuss 2 3 Trees and their algorithms:
- Balanced Trees from online book Algorithms 4th Edition.
- Data Structures Balanced Trees from Univ. of Nevada CS 302 Data Structures.
- Balanced Search Trees from Simon Frazer Univ. Data Structure and Programming.
- Deletion in 2 3 trees from USC Data Structure and Object Oriented Design.
- Virgina Tech 2 3 Tree slides from Virgina Tech Data Structures and ObjectOriented Development.
The key and value are stored in a KeyValue object that is a union of two std::pair
's. KeyValue has a move assignement and move constructor to improve the efficiency of the tree insertion
algorithm. Using a unions allows us to write to the std::pair<Key, Value>
member without the need for constantly doing const_cast<Key&>(key) = k
, but also allow
the tree23<Key,Value>
's iterators to return pair<const Key, Value>
references, again without the need to use explicit const_cast<>
throughout the code.
See the comments in the code for more implementation details.