Patricia - PowerPoint PPT Presentation

About This Presentation
Title:

Patricia

Description:

Patricia. Practical Algorithm To Retrieve Information Coded In Alphanumeric. ... All nodes are of the same data type (binary tries use branch and element nodes) ... – PowerPoint PPT presentation

Number of Views:322
Avg rating:3.0/5.0
Slides: 19
Provided by: programmi
Category:

less

Transcript and Presenter's Notes

Title: Patricia


1
Patricia
  • Practical Algorithm To Retrieve Information Coded
    In Alphanumeric.
  • Compressed binary trie.
  • All nodes are of the same data type (binary tries
    use branch and element nodes).
  • Pointers to only one kind of node.
  • Simpler storage management.

2
Patricia
  • Uses a header node.
  • Remaining nodes define a trie structure that is
    the left subtree of the header node.
  • Trie structure is the same as that for the
    compressed binary trie of previous lecture.

3
Node Structure
  • bit bit used for branching
  • LC left child pointer
  • Pair dictionary pair
  • RC right child pointer

4
Compressed Binary Trie To Patricia
Move each element into an ancestor or header node.
5
Compressed Binary Trie To Patricia
0
1
0
1
3
2
0
1
0
1
4
4
1
1
0
0
6
Insert
Insert 0000101
Insert 0000000
7
Insert
Insert 0000000
Insert 0000010
8
Insert
Insert 0001000
9
Insert
Insert 0000100
10
Insert
Insert 0001010
11
Insert
Insert 0001010
12
Delete
  • Let p be the node that contains the dictionary
    pair that is to be deleted.
  • Case 1 p has one self pointer.
  • Case 2 p has no self pointer.

13
p Has One Self Pointer
  • p header gt trie is now empty.
  • Set trie pointer to null.
  • p ! header gt remove node p and update pointer
    to p.

14
p Has No Self Pointer
  • Let q be the node that has a back pointer to p.
  • Node q was determined during the search for the
    pair with the delete key k.

15
p Has No Self Pointer
p
q
y
  • Use the key y in node q to find the unique node r
    that has a back pointer to node q.

16
p Has No Self Pointer
  • Copy the pair whose key is y to node p.

17
p Has No Self Pointer
  • Change back pointer to q in node r to point to
    node p.

18
p Has No Self Pointer
p
q
y
r
Node q now has been removed from trie.
z
  • Change forward pointer to q from parent(q) to
    child of q.
Write a Comment
User Comments (0)
About PowerShow.com