Higher Order Tries - Advanced Data Structures - Lecture Slides, Slides of Computer Science

These are the Lecture Slides of Advanced Data Structures which includes Split Algorithm, Unbalanced Binary Search Trees, Forward Pass, Forward Pass Example, Backward Cleanup Pass, Retrace Path, Current Nodes, Roots of Respective Tries, Branch Nodes etc. Key important points are: Higher Order Tries, Social Security Number, Decimal Digits, Branches on Digits Plus, Social Security Avl, Red-Black Tree, Best Binary Tree, Nonnull Pointers in Node, Variable Length Keys

Typology: Slides

2012/2013

Uploaded on 03/19/2013

dharmakeerti
dharmakeerti 🇮🇳

4.2

(27)

89 documents

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Higher Order Tries
Key =Social Security Number.
441-12-1135
9 decimal digits.
10-way trie (order 10 trie).
0123456789
Height <= 10.
Social Security Trie
10-way trie
Height <= 10.
Search => <= 9 branches on digits plus 1compare.
100-way trie
441-12-1135
Height <= 6.
Search => <= 5 branches on digits plus 1compare.
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Higher Order Tries - Advanced Data Structures - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

Higher Order Tries

  • Key = Social Security Number.

ƒ 9 decimal digits.

  • 10 -way trie (order 10 trie).

Height <= 10.

Social Security Trie

  • 10 -way trie

ƒ Height <= 10.

ƒ Search => <= 9 branches on digits plus 1 compare.

  • 100 -way trie

ƒ Height <= 6.

ƒ Search => <= 5 branches on digits plus 1 compare.

Social Security AVL & Red-Black

  • Red-black tree

ƒ Height <= 2log 2

9 ~ 60.

ƒ Search => <= 60 compares of 9 digit numbers.

  • AVL tree

ƒ Height <= 1.44log 2

9 ~ 40.

ƒ Search => <= 40 compares of 9 digit numbers.

  • Best binary tree.

ƒ Height = log 2

9 ~ 30.

Compressed Social Security Trie

#ptr

char#

  • char# = character/digit used for branching.

ƒ Equivalent to bit# field of compressed binary trie.

  • #ptr = # of nonnull pointers in the node.

Insert

Insert 079864231.

Insert

Insert 012345618.

Insert

Insert 011917352.

Insert

"^1

Delete

Delete 015231671.

Delete

Variable Length Keys

Insert 0123.

Problem arises only when one key is a (proper)

prefix of another.

Variable Length Keys

Insert 0123.

Add a special end of key character (#) to each key

to eliminate this problem.

Example

element field shown in blue.

Etc.

  • Expected height of an order m trie is ~log m

n.

  • Limit height to h (say 6 ). Level h branch nodes

point to buckets that employ some other search

structure for all keys in subtrie.

Etc.

  • Switch from trie scheme to simple array when

number of pairs in subtrie becomes <= s (say s =

ƒ Expected # of branch nodes for an order m trie when

n is large and m and s are small is n/(s ln m).

  • Sample digits from right to left (instead of from

left to right) or using a pseudorandom number

generator so as to reduce trie height.

Multibit Tries

  • Variant of binary trie in which the number of bits

(stride) used for branching may vary from node

to node.

  • Proposed for Internet router applications.

ƒ Variable length prefixes.

ƒ Longest prefix match.

  • Limit height by choosing node strides.

ƒ Root stride = 32 => height = 1.

ƒ Strides of 16 , 8 , and 8 for levels 1 , 2 , and 3 => only 3

levels.

Web Resource

  • See Web writeup for additional applications

of tries.

ƒ Prefix search.

ƒ Automatic command (or phone number or

URL) completion.

ƒ LZW compression (longest matching prefix).

Web Resource

  • See Web writeup for alternative node

structures for tries.

ƒ Array

ƒ Chain

ƒ Binary search tree

ƒ Hash table