by David Thomas — 8th December 2016
ADFS::HardDisc4.$.Images.Fred ADFS::HardDisc4.$.Images.Jim ADFS::HardDisc4.$.Images.Sheila
So I went off down the rabbit hole and researched and wrote a load of tree stuff unrelated to the original inquiry
Oops
Containers implements:
Let's have a look...
Invented: 1960
Uses a compare callback
Compares the whole entry
Chooses left/right from compare result
Pros
Pretty simple
Cons
Quality of tree depends on insertion order:
inserting in-order data will lead to a lopsided tree
Invented: ?
Examines keys bitwise to decide how to branch
First bit at first level, second bit at second level, & so on
While bits of keys are equal follows the path
Single type of tree node
Pros
Relatively simple
Invented: 1959
Name comes from "reTRIEval", pronunciation...
Keeps the keys in the tree in order
Two types of node: internal and external
Internal nodes differentiate key bits
External nodes (leaves) hold the data
Cons
Creates a node per differing key bit - lots of internal nodes
Much like a trie but avoids profligate internal nodes by counting bits
Has internal and external nodes
https://www.imperialviolet.org/binary/critbit.pdf
Invented: 1968
A compact representation of a trie in which any node that is an only child is merged with an ancestor
A crit-bit tree but folded in on itself
Does away with the two node types:
Single type of node that's used in two ways
Cons
Very difficult to grok
I totally failed to write the delete function
I'm not entirely convinced that current descriptions on Wikipedia match the trees I've described, or indeed anyone else's idea
https://github.com/dpt/Containers
Sedgewick: Algorithms
http://algs4.cs.princeton.edu/home/