Tries - Tries 5/24/2002 8:37 AM Outline and Reading...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
5/24/2002 8:37 AM Tries 1 Tries e nimize nimize ze ze i mi mize nimize ze 5/24/2002 8:37 AM Tries 2 Outline and Reading Standard tries (§9.2.1) Compressed tries (§9.2.2) Suffix tries (§9.2.3) Huffman encoding tries (§9.3.1) 5/24/2002 8:37 AM Tries 3 Preprocessing Strings Preprocessing the pattern speeds up pattern matching queries ± After preprocessing the pattern, KMP’s algorithm performs pattern matching in time proportional to the text size If the text is large, immutable and searched for often (e.g., works by Shakespeare), we may want to preprocess the text instead of the pattern A trie is a compact data structure for representing a set of strings, such as all the words in a text ± A tries supports pattern matching queries in time proportional to the pattern size 5/24/2002 8:37 AM Tries 4 Standard Trie (1) The standard trie for a set of strings S is an ordered tree such that: ± Each node but the root is labeled with a character ± The children of a node are alphabetically ordered ± The paths from the external nodes to the root yield the strings of S Example: standard trie for the set of strings S = { bear, bell, bid, bull, buy, sell, stock, stop } a e b r l l s u l l y e t l l o c k p i d 5/24/2002 8:37 AM Tries 5 Standard Trie (2)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Tries - Tries 5/24/2002 8:37 AM Outline and Reading...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online