Searching with Structured
Keys
Objectives
|
|
|
To look at search structures for
variable length and multidimensional keys. |
|
To understand several basic radix
search techniques, their advantages and disadvantages |
|
To look at range queries and partial
match searches in multidimensional structures. |
Slide 2
Radix Sorting Technique
Radix Searching
Techniques
Digital Search Trees
Slide 6
Digital Search Tree
Updates
Digital Search Tree
Updates
Digital Search Trees -
Costs
|
|
|
The number of nodes inspected in a
search is, at most, the number of leading bits needed to distinguish it from
other keys |
|
For “randomly distributed” keys this
should be Θ(log n), but if keys agree on lead bits problems arise |
|
But, visiting each node involves a key
comparison, this may be the bulk of the cost |
Radix Search Tries
“trie” as in “retrieval” is pronounced “try”
Radix Search Trie Updates
|
|
|
If you “fall out”, hang a new node on
there |
|
If you come to a leaf continue
the path in the tree with
the two elements
until the bits differ |
"Only n nodes of
storage"
|
|
|
Only n nodes of storage |
|
Just one full key compare |
|
No “useless” tests |
|
|
Patricia: Step 1
Leave out 1 way branch nodes
|
|
|
Add to each node the position of the
bit to be tested (we will still move left to right) |
"Patricia:"
|
|
|
Patricia: Step 2 |
|
Add the “dummy value” 00000 (which is
either not stored or stored in the header). |
|
Store keys in internal nodes that are ancestors
of their leaf positions in the tree |
Patricia Insertions
|
|
|
Insertions can be made in the natural
way. |
|
Follow the search path of new leaf. |
|
Determine the highest number bit where
new key and leaf key differ. |
|
Retrace search path to the point where
a test on this bit could occur. |
|
Insert new node there with the node on
the path to leaf node as one child and a new leaf containing the new key |
Slide 16
Slide 17
Slide 18
Slide 19
Radix Techniques
|
|
|
Insensitive to order of insertions |
|
Sensitive to particular value |
|
Very useful for long or variable length
keys |