Van Emde Boaz Tries (The presentation follows Willard - PowerPoint PPT Presentation

About This Presentation
Title:

Van Emde Boaz Tries (The presentation follows Willard

Description:

Table stores m keys so that find(x) takes O(1) time. Dynamic perfect hashing: ... Store all prefixes of the keys in a hash table. 0, 00, 000, 0000, 001, 0011, 1, 10, ... – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 17
Provided by: Sint1
Category:

less

Transcript and Presenter's Notes

Title: Van Emde Boaz Tries (The presentation follows Willard


1
Van Emde Boaz Tries(The presentation follows
Willards fast tries)
2
RAM model
  • We have integers in the input
  • Each integer U
  • A computer work can store log(U) bits

Suppose we want to solve the dictionary
problem Insert(x), delete(x), find(x)
Hashing
3
Perfect hashing
Build an O(m) table in (randomized) O(m) time
Table stores m keys so that find(x) takes O(1)
time
Dynamic perfect hashing Can also insert(x) and
delete(x) in O(1) time (amortized expected)
4
The successor problem
In addition to find(x), insert(x), delete(x)
We have successor(x) and predecessor(x)
5
Trie
0
1
1101
0000
0011
1000
1001
Depth is log(U) and we have m leaves
Can do all operations in O(log(U))
6
Willards trie
0, 00, 000, 0000, 001, 0011, 1, 10, 100, 1000, .
0
1
1101
0000
0011
1000
1001
Store all prefixes of the keys in a hash table
7
0, 00, 000, 0000, 001, 0011, 1, 10, 100, 1000, .
0
1
1101
0000
0011
1000
1001
1100
Find(x) We can find the longest prefix of x in
the trie by a binary search
8
0, 00, 000, 0000, 001, 0011, 1, 10, 100, 1000, .
0
1
1101
0000
0011
1000
1001
1100
9
0, 00, 000, 0000, 001, 0011, 1, 10, 100, 1000, .
0
1
1101
0000
0011
1000
1001
1100
Now if each node knows the minimum and the
maximum in its subtree, we have either the
successor or the predecessor
10
0, 00, 000, 0000, 001, 0011, 1, 10, 100, 1000, .
0
1
1101
0000
0011
1000
1001
1100
To have them both we doubly link the items
11
Summary
So we can search in O(loglogU) time
Remaining problems
Space is not linear its O(nlog(U)) !
Updates take O(log(U)) time
12
Partition the items into groups of size O(logU)
each
Maintain the minimum of each group in a trie as
before
0100
0000
1001
13
0
1
0100
0000
1001
Use a binary search tree to represent each group
14
0
1
0100
0000
1001
15
Summary
Now space is linear
Search still takes O(loglogU) time
To insert or delete work within subtree -- This
takes O(loglogU) time
If a subtree get too large split it and insert a
new item into the trie. This would take O(logU)
but we peform it once for O(logU) insertions
16
Summary (Cont)
Delete is similar We work within a set, when a
set gets too small we merge it with its neighbor
Write a Comment
User Comments (0)
About PowerShow.com