Static Predecessor Problem

Problem Definition

Word RAM Model


Note

By choosing the better of vEB trees or Fusion trees we can achieve query times min(logw,logwn)logn. Thus with dynamic fusion trees we can get O(nlogn).

Van Emde Boas Tree (vEB)

We express every element x{0,,u1} in binary form and split it into it's lower half and upper half (in terms of bits) say c,i. This essentially rewrites x in base u. We store i in the c-th cluster. During the insertion if the c-th cluster was empty we add c to the summary i.e. the summary tracks which clusters are non-empty.

The query can be defined in the following manner:

pred(V, x = <c, i>):
	if x > v.max: return V.max
	else if V.cluster[c].min < x:
		return pred(V.cluster[c], i)
	else:
		c' = pred(V.summary, c)
		return V.cluster[c'].max

Query time: T(u)=T(u)+O(1)=O(loglogu)=O(logw)

We define insertion as follows:

insert(V, x = <c, i>):
	if V is empty:
		V.min = x;
		return;
	if x < V.min: swap(x, V.min)
	if x > V.max: V.max = x
	if V.cluster[c].min == null:
		insert(V.summary, c)	
	insert(V.cluster[c], i)

Insertion time:

Space:

Y-Fast tries

x-fast trie: We can improve the space usage by storing the 1's in a hash table; where the key is the index of a particular node. Thus when we search we simply check whether a key exists. This takes O(nw) space since each level contains at most n 1's.

y-fast trie: We use indirection. If we have a x-fast trie on n/w items where each item is a balanced BST with ~w sub-items whose smallest element is the representative element for the top level x-fast trie. This takes O(n) space. Insertion and deletion takes O(logw)=O(loglogu).

Fusion Trees

References