notes62

notes62 - CS251: Data Structures 4/10/2006 - 4/14/2006...

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

View Full Document Right Arrow Icon
CS251: Data Structures 4/10/2006 - 4/14/2006 Class Notes Tries The standard trie for a set of string "s", is an ordered set such that: o Each node except for the root is labeled with a character o The children of a node are alphabetically sorted o The paths from the root to the external nodes yields strings of "s" s = {bear, bell, apple, bird, buy, add} A trie allows for fast searching of a word Finding the data that corresponds to a word takes: o O(m) : the size of the string (that is if finding the child that corresponds to a char takes O(1). (hash, or an array of children)) o However, if finding a child takes O(d), where d is the size of the alphabet, then a look-up will be O(m*d). A tri is a good data structure for a dictionary or search engine. o Doesn't work so well if you have to perform removals. You can also use it to represent positions of the occurence of the string in a text Compressed Trie It is obtained by collapsing the characters of redundant nodes. Suffix Trie A compressed trie for all the suffixes of a text
Background image of page 1

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

View Full DocumentRight Arrow Icon
It supports pattern matching Examples: o strstr(ini, text) --> returns true
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

notes62 - CS251: Data Structures 4/10/2006 - 4/14/2006...

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

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