Digital search tree & Radix search trie - a brief description

Digital search tree

Works otherwise like the binary search tree, but branching is based on the bits of the search key.
If we have a key bit(0)bit(1)bit(2)bit(3) (bit(0) is the most significant bit) and we must branch at level k  (root is at level 0) , we
choose left branch if the bit(k) is 0 and the right branch if the bit(k) is 1.

Example: searching the letter E from a digital search tree

dsearch.gif (8564 bytes)

 

Radix Search trie

Searching
  1. Start from the root node and from the most significant bit
  2. Go forward bit by bit on the trie until you find a leaf node
  3. Check if the item is in the leaf node
Insertion
  1. Find the place of the item by following bits
  2. If there is nothing, just insert the item there as a leaf node
  3. If there is something on the leaf node, it becomes a new innernode. Build a new subtree or subtrees to that inner node depending how
    the item to be inserted and the item that was in the leaf node differs.
  4. Create new leaf nodes where you store the item that was to be inserted and the item that was originally in the leaf node.
Deletion
  1. Remove the item
  2. Remove the leaf node where the item was
  3. If the nearest sister node is also a leaf node, shorten the tree until the sister node differs only by one bit from some other branch of the tree.

Example: a radix search trie

rtrie.gif (2899 bytes)

Example: searching

rtrie_search.gif (11370 bytes)

Example: inserting a key to the trie

rtrie_insert.gif (20251 bytes)