SlideShare a Scribd company logo
1 of 18
TRIES DATA STRUCTURE
Presented By – Aman Tandon
5 June 2014
Outline
• Understand Requirements
• What is Trie?
• Different types of Tries.
• Memory and Time Analysis using Tries
• Various application of the Tries
Understand Requirements
● Insertion is faster as compared to the Hash
Table
● Lookup is much more faster than hash table
implementations
● You can store as many keys as much you want
without any reconstruction as like in Hash Table
if size becomes full
● There are no collision of different keys in tries
What is TRIE?
• The term trie comes from retrieval. This term
was coined by Edward Fredkin, who pronounce
it tri as in the word retrieval
• In computer science, a trie, also called digital
tree and sometimes radix tree or prefix tree
• All the descendants of a node have a common
prefix of the string associated with that node,
and the root is associated with the empty string.
Different Types of Tries
● Standard Tries
● Compressed/Compact Tries
● Suffix Tries
Standard Tries
• The standard trie for a set of strings S is an
ordered tree such that:
o each node but the root is labeled with a
character
o the children of a node are alphabetically
ordered
o the paths from the external nodes to the root
yield the strings of S
•The number of children a node can have is the
size/total number of characters in the language
and all children are ordered alphabetically.
•leaf node is represented as square
•Example: standard trie for the set of strings S = {
bear, bell, bid, bull, buy, sell, stock, stop }
Diagram: Standard Tries
● A standard trie uses O(n) space. Operations (find,insert,
remove) take time O(dm) each, where:
○ n = total size of the strings in S
○ m =size of the string parameter of the operation
○ d =alphabet size
● The bad thing about this data structure is space
requirements
Time/Space complexity of Standard Tries
Applications of Standard Tries
● word matching: find the first occurrence of word X in the text
● prefix matching: find the first occurrence of the longest prefix of word X in
the text
Compressed Tries
● The bad thing about the standard tries is the space requirements, to overcome we
can use the compressed tries
● Compressed Trie are with the nodes of degree at least 2
● If any node has only one child, then we can merge it into a single node
Searching(bbaa) in Compressed Tries
Insertion and Deletion in Compressed Tries
Suffix Tries
A suffix trie is a compressed trie for all the suffixes
of a text
Compact representation of Suffix Tree
Tries and Web Search Engines
● The index of a search engine (collection of all
searchable words) is stored into a compressed
trie
● Each leaf of the trie is associated with a word
and has a list of pages (URLs) containing that
word, called occurrence list
● The trie is kept in internal memory
●The occurrence lists are kept in external
memory and are ranked by relevance
●Boolean queries for sets of words (e.g., Java
and coffee) correspond to set operations
(e.g.,intersection) on the occurrence lists
TRIES_data_structure

More Related Content

What's hot

Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
ghhgj jhgh
 

What's hot (20)

Bfs and dfs in data structure
Bfs and dfs in  data structure Bfs and dfs in  data structure
Bfs and dfs in data structure
 
Trees
Trees Trees
Trees
 
Quick sort
Quick sortQuick sort
Quick sort
 
Tree
TreeTree
Tree
 
Discrete Mathematics Tree
Discrete Mathematics  TreeDiscrete Mathematics  Tree
Discrete Mathematics Tree
 
Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures
 
Depth first search [dfs]
Depth first search [dfs]Depth first search [dfs]
Depth first search [dfs]
 
DFS and BFS
DFS and BFSDFS and BFS
DFS and BFS
 
Skip lists (Advance Data structure)
Skip lists (Advance Data structure)Skip lists (Advance Data structure)
Skip lists (Advance Data structure)
 
Introduction to tree
Introduction to treeIntroduction to tree
Introduction to tree
 
Binary search tree in data structures
Binary search tree in  data structuresBinary search tree in  data structures
Binary search tree in data structures
 
Linear Search Data Structure
Linear Search Data StructureLinear Search Data Structure
Linear Search Data Structure
 
Data Structure and Algorithms Merge Sort
Data Structure and Algorithms Merge SortData Structure and Algorithms Merge Sort
Data Structure and Algorithms Merge Sort
 
Linked lists
Linked listsLinked lists
Linked lists
 
UNIT III NON LINEAR DATA STRUCTURES – TREES
UNIT III 	NON LINEAR DATA STRUCTURES – TREESUNIT III 	NON LINEAR DATA STRUCTURES – TREES
UNIT III NON LINEAR DATA STRUCTURES – TREES
 
Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure
 
Binary tree
Binary  treeBinary  tree
Binary tree
 
9. Searching & Sorting - Data Structures using C++ by Varsha Patil
9. Searching & Sorting - Data Structures using C++ by Varsha Patil9. Searching & Sorting - Data Structures using C++ by Varsha Patil
9. Searching & Sorting - Data Structures using C++ by Varsha Patil
 
Threaded binary tree
Threaded binary treeThreaded binary tree
Threaded binary tree
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
 

Viewers also liked

Introduction of suffix tree
Introduction of suffix treeIntroduction of suffix tree
Introduction of suffix tree
Liou Shu Hung
 
Packet forwarding in wan.46
Packet  forwarding in wan.46Packet  forwarding in wan.46
Packet forwarding in wan.46
myrajendra
 
Priority Lands September 25 2008
Priority Lands September 25 2008Priority Lands September 25 2008
Priority Lands September 25 2008
ecopatriot80
 

Viewers also liked (20)

Trie tree
Trie treeTrie tree
Trie tree
 
Trees data structure
Trees data structureTrees data structure
Trees data structure
 
Tries, conversions and field goals
Tries, conversions and field goalsTries, conversions and field goals
Tries, conversions and field goals
 
Interactive High-Dimensional Visualization of Social Graphs
Interactive High-Dimensional Visualization of Social GraphsInteractive High-Dimensional Visualization of Social Graphs
Interactive High-Dimensional Visualization of Social Graphs
 
Introduction of suffix tree
Introduction of suffix treeIntroduction of suffix tree
Introduction of suffix tree
 
Multi way&btree
Multi way&btreeMulti way&btree
Multi way&btree
 
Packet forwarding in wan.46
Packet  forwarding in wan.46Packet  forwarding in wan.46
Packet forwarding in wan.46
 
Chapter 15
Chapter 15Chapter 15
Chapter 15
 
Suffix Tree and Suffix Array
Suffix Tree and Suffix ArraySuffix Tree and Suffix Array
Suffix Tree and Suffix Array
 
Geo webinarjune2015
Geo webinarjune2015Geo webinarjune2015
Geo webinarjune2015
 
B trees and_b__trees
B trees and_b__treesB trees and_b__trees
B trees and_b__trees
 
Priority Lands September 25 2008
Priority Lands September 25 2008Priority Lands September 25 2008
Priority Lands September 25 2008
 
K d tree_cpp
K d tree_cppK d tree_cpp
K d tree_cpp
 
TripleTree eDiscovery
TripleTree  eDiscoveryTripleTree  eDiscovery
TripleTree eDiscovery
 
Dynamic DFS in Undirected Graph using Segment Tree
Dynamic DFS in Undirected Graph using Segment TreeDynamic DFS in Undirected Graph using Segment Tree
Dynamic DFS in Undirected Graph using Segment Tree
 
R-Trees and Geospatial Data Structures
R-Trees and Geospatial Data StructuresR-Trees and Geospatial Data Structures
R-Trees and Geospatial Data Structures
 
Ch15 Heap
Ch15 HeapCh15 Heap
Ch15 Heap
 
Problems with-planting-tress-interval
Problems with-planting-tress-intervalProblems with-planting-tress-interval
Problems with-planting-tress-interval
 
B trees and_b__trees
B trees and_b__treesB trees and_b__trees
B trees and_b__trees
 
Segment tree
Segment treeSegment tree
Segment tree
 

Similar to TRIES_data_structure

Set Similarity Search using a Distributed Prefix Tree Index
Set Similarity Search using a Distributed Prefix Tree IndexSet Similarity Search using a Distributed Prefix Tree Index
Set Similarity Search using a Distributed Prefix Tree Index
HPCC Systems
 

Similar to TRIES_data_structure (20)

Trie (1)
Trie (1)Trie (1)
Trie (1)
 
Tries .ppt
Tries .pptTries .ppt
Tries .ppt
 
Shishirppt
ShishirpptShishirppt
Shishirppt
 
Set Similarity Search using a Distributed Prefix Tree Index
Set Similarity Search using a Distributed Prefix Tree IndexSet Similarity Search using a Distributed Prefix Tree Index
Set Similarity Search using a Distributed Prefix Tree Index
 
presentation on important DAG,TRIE,Hashing.pptx
presentation on important DAG,TRIE,Hashing.pptxpresentation on important DAG,TRIE,Hashing.pptx
presentation on important DAG,TRIE,Hashing.pptx
 
Souvenir's Booth - Algorithm Design and Analysis Project Project Report
Souvenir's Booth - Algorithm Design and Analysis Project Project ReportSouvenir's Booth - Algorithm Design and Analysis Project Project Report
Souvenir's Booth - Algorithm Design and Analysis Project Project Report
 
Web search engines
Web search enginesWeb search engines
Web search engines
 
Lecture10.pdf
Lecture10.pdfLecture10.pdf
Lecture10.pdf
 
Souvenir's Booth - Algorithm Design and Analysis Project Presentation
Souvenir's Booth - Algorithm Design and Analysis Project PresentationSouvenir's Booth - Algorithm Design and Analysis Project Presentation
Souvenir's Booth - Algorithm Design and Analysis Project Presentation
 
Unit 3,4.docx
Unit 3,4.docxUnit 3,4.docx
Unit 3,4.docx
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & Algorithms
 
HPEC 2021 sparse binary format
HPEC 2021 sparse binary formatHPEC 2021 sparse binary format
HPEC 2021 sparse binary format
 
Information Retrieval Dynamic Time Warping - Interspeech 2013 presentation
Information Retrieval Dynamic Time Warping - Interspeech 2013 presentationInformation Retrieval Dynamic Time Warping - Interspeech 2013 presentation
Information Retrieval Dynamic Time Warping - Interspeech 2013 presentation
 
Information and network security 27 triple des
Information and network security 27 triple desInformation and network security 27 triple des
Information and network security 27 triple des
 
introtonlp-190218095523 (1).pdf
introtonlp-190218095523 (1).pdfintrotonlp-190218095523 (1).pdf
introtonlp-190218095523 (1).pdf
 
Bioinformatics p2-p3-perl-regexes v2013-wim_vancriekinge
Bioinformatics p2-p3-perl-regexes v2013-wim_vancriekingeBioinformatics p2-p3-perl-regexes v2013-wim_vancriekinge
Bioinformatics p2-p3-perl-regexes v2013-wim_vancriekinge
 
Intro to nlp
Intro to nlpIntro to nlp
Intro to nlp
 
Shilpa shukla processing_text
Shilpa shukla processing_textShilpa shukla processing_text
Shilpa shukla processing_text
 
Elasticsearch selected topics
Elasticsearch selected topicsElasticsearch selected topics
Elasticsearch selected topics
 
Basic Introduction to Python Programming
Basic Introduction to Python ProgrammingBasic Introduction to Python Programming
Basic Introduction to Python Programming
 

TRIES_data_structure

  • 1. TRIES DATA STRUCTURE Presented By – Aman Tandon 5 June 2014
  • 2. Outline • Understand Requirements • What is Trie? • Different types of Tries. • Memory and Time Analysis using Tries • Various application of the Tries
  • 3. Understand Requirements ● Insertion is faster as compared to the Hash Table ● Lookup is much more faster than hash table implementations ● You can store as many keys as much you want without any reconstruction as like in Hash Table if size becomes full ● There are no collision of different keys in tries
  • 4. What is TRIE? • The term trie comes from retrieval. This term was coined by Edward Fredkin, who pronounce it tri as in the word retrieval • In computer science, a trie, also called digital tree and sometimes radix tree or prefix tree • All the descendants of a node have a common prefix of the string associated with that node, and the root is associated with the empty string.
  • 5. Different Types of Tries ● Standard Tries ● Compressed/Compact Tries ● Suffix Tries
  • 6. Standard Tries • The standard trie for a set of strings S is an ordered tree such that: o each node but the root is labeled with a character o the children of a node are alphabetically ordered o the paths from the external nodes to the root yield the strings of S
  • 7. •The number of children a node can have is the size/total number of characters in the language and all children are ordered alphabetically. •leaf node is represented as square •Example: standard trie for the set of strings S = { bear, bell, bid, bull, buy, sell, stock, stop }
  • 9. ● A standard trie uses O(n) space. Operations (find,insert, remove) take time O(dm) each, where: ○ n = total size of the strings in S ○ m =size of the string parameter of the operation ○ d =alphabet size ● The bad thing about this data structure is space requirements Time/Space complexity of Standard Tries
  • 10. Applications of Standard Tries ● word matching: find the first occurrence of word X in the text ● prefix matching: find the first occurrence of the longest prefix of word X in the text
  • 11. Compressed Tries ● The bad thing about the standard tries is the space requirements, to overcome we can use the compressed tries ● Compressed Trie are with the nodes of degree at least 2 ● If any node has only one child, then we can merge it into a single node
  • 13. Insertion and Deletion in Compressed Tries
  • 14. Suffix Tries A suffix trie is a compressed trie for all the suffixes of a text
  • 16. Tries and Web Search Engines ● The index of a search engine (collection of all searchable words) is stored into a compressed trie ● Each leaf of the trie is associated with a word and has a list of pages (URLs) containing that word, called occurrence list ● The trie is kept in internal memory
  • 17. ●The occurrence lists are kept in external memory and are ranked by relevance ●Boolean queries for sets of words (e.g., Java and coffee) correspond to set operations (e.g.,intersection) on the occurrence lists