Important note: This code is
only meant to provide some inspiration for the final code. This code is clearly
not correct as is. It certainly doesn’t handle all special cases. It maybe also
contain some errors in the cases that it does
handle. Use at your own risk.
Node = stucture/record
bittring
value
Int position
Node*
next[0…1]
Search( node* root, bittring key)
Child = root->next[key[root->position]]
If Child->position <= root->position then
Return key == Child->value
Else Search(Child, key)
Insert( node* root, bittring key)
Child = root->next[key[root->position]]
If Child->position <=
root->position then
i=0
while
key[i] == Child->value[i] do i++
if i
> root->position then
temp = child
root->next[key[root->position]]
= new node
temp2 = root->next[key[root->position]]
temp2->string=key
temp2->position = i
temp2->next[key[i]]=temp2
temp2->next[temp->value[i]] = temp
else insert2(root,
string, i)
Else Insert(Child, key)
Insert2( node* root, bittring key, int place)
Child = root->next[key[root->position]]
If root->position <= place <= child[position]
then
temp = new node
root->next[key[root->position]] = temp
temp->value=key
temp->position=place
temp->next[key[place]]
= temp
temp->next[1 –
key[place]] = child
else insert2(child, key, position)