SlideShare a Scribd company logo
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
1
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
2
 After completing this chapter, the reader will be able to
understand the following:

 Basic tools needed to develop and analyze algorithms
 Methods to compute the efficiency of algorithms
 Ways to make a wise choice among many solutions for a
given problem
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
3
Algorithm Analysis
Asymptoti c Notations (W, p, O)
Big Omega (W)
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
4
Algorithm Analysis
Asymptoti c Notations (W, p, O)
Big Omega (W)
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
5
 The following steps elaborate the general structure of the
divide-and-conquer strategy
 If the data size n of problem P is fundamental,
calculate the result of P(n) and go to step 4
 If the data size n of problem P is not fundamental,
divide the problem P(n) into equivalent subproblems
P(n1), P(n2), … P(ni) such that i ≥ 1
 Apply divide-and-conquer recursively to each
individual subproblem P(n1), P(n2), …,P(ni)
 Combine the results of all subproblems P(n1), P(n2),…,
P(ni) to get the final solution of P(n)
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
6
 At level one, only one call to a partition is made
with n elements; at level two, Atmost two calls are
made with elements (n - 1), and so on
C(n) = O(n2)
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
7
 General
 Knapsack Problem
 Elements of Greedy Strategy
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
8
 To decide whether a problem can be solved using a
greedy strategy, the following elements should be
considered:
 Greedy-choice property
 Optimal substructure Greedy Method
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
9
 Greedy-choice property A problem exhibits
greedy-choice property if a globally optimal
solution can be arrived at by making a locally
optimal greedy choice
 That is, we make the choice that seems best at
that time without considering the results from
the sub problems
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
10
 The General Method
 Elements of Dynamic Programming
 Principle of Optimality
 Limitations of Dynamic Programming
 Knapsack Problem
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
11
 The General Method
 Elements of Dynamic Programming
 Principle of Optimality
 Limitations of Dynamic Programming
 Knapsack Problem
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
12
A dynamic programming solution has the following three
components:
 Formulate the answer as a recurrence relation or a
recursive algorithm
 Show that the number of different instances of your
recurrence is bounded by a polynomial
 Specify an order of evaluation for the recurrence
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
13
To decide whether a problem can be solved using the dynamic
programming method, the following three elements of dynamic
programming should be considered:

 Optimal substructure
 Overlapping subproblems
 Memorization
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
14
 A problem exhibits optimal substructure if an optimal
solution to the problem contains within it optimal
solutions to subproblems
 It also means that dynamic programming (and greedy
method) might apply
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
15
 When a recursive algorithm revisits the same problem
repeatedly, it is said that the optimization problem has
overlapping sub problems
 This is beneficial for dynamic programming
 It solves each subproblem once and stores the answer in a
table
 This answer can be searched in constant time when required.
This is contradictory to the divide-and-conquer strategy
where a new problem is generated at each step of recursion
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
16
 A problem exhibits optimal substructure if an optimal
solution to the problem contains within it optimal solutions
to subproblems
 It also means that dynamic programming (and greedy
method) might apply
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
17
 However, it uses the control structure similar to the
recursive algorithm
 In a memorized recursive algorithm, an entry is
maintained in a table for the solution to each subproblem
 Initially, all entries contain a special value, which
indicates that the entry is not yet used
 For each subproblem, which is encountered for the first
time, its solution is computed and stored in the table
 Next time, for that subproblem, its entry is searched and
the value is used
 This can be implemented using hashing
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
18
 The principle of optimality states that an optimal
sequence of decisions has the property that whatever
the initial state and decision are, the remaining
decisions must constitute an optimal decision
sequence with regard to the state resulting from the
first decision
Principle of Optimality
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
19
 Pattern matching is the process of finding the
presence of a particular string (pattern) in the given
string (text)
Pattern Matching
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
20
 Database search
 Search engine
 Text editors
 Intrusion detection
 Natural language processing
 Feature detection in digitized images
A few such applications are as follows:
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
21
The most popular are the following:
Brute-force approach
Boyer–Moore algorithm
Knuth–Morris–Pratt algorithm
Robin–Karp algorithm
Text partitioning algorithm
Semi-numerical algorithm
Popular techniques for
string pattern search
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
22
 String : A string is a finite sequence of symbols that are
chosen from a set or alphabet:
 Alphabet is a set of characters or symbols
 Substring: A substring or subsequence of a string is a
subset of the symbols in a string where the order of
elements is preserved
 Suffix: A suffix of S is a substring S[i, …, m − 1], where i
ranges between 0 and m − 1
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
23
 This is a simple straight forward approach based on
the comparison of a pattern character by character
with a string
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
24
 The steps involved in this approach are as
follows:
 Adjust the pattern P at beginning of the text
 Start moving from left to right and compare the
character of pattern to the corresponding character
in text
 Continue with step 2 until successful (all characters
of the pattern are matched) or unsuccessful (a
mismatch is detected)
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
25
 Boyer and Moore have developed an efficient pattern
matching algorithm
 Instead of sliding by one character to the right at a time, in
Boyer–Moore approach, the sliding to the right is done in
longer steps
 The algorithm scans the character of pattern from right to
left beginning with the rightmost character
 If the text symbol compared with the rightmost
pattern symbol does not occur in the pattern at all, then the
pattern can be shifted by m positions (where m is length
of pattern)
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
26
 The researchers Knuth, Morris, and Pattern
proposed a linear time algorithm for the string
matching problem
 In this approach, a matching time of O(n) is
achieved by avoiding comparisons with characters
of T that have previously been involved in
comparison with some element of the pattern P to
be matched so that backtracking is avoided
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
27
 The KMP matcher finds the occurrence of the
pattern P in text T and returns the number of shifts
of P, after which the occurrence is found taking T, P,
and prefix function p as inputs
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
28
 A compact data structure that represents a set of
strings (such as all the words in a text) known as tries
 A trie is a tree-based data structure for storing strings
to make pattern matching faster
 A trie helps in pattern matching in time that is
proportional to the length of the pattern
 Tries can be used to perform prefix query for
information retrieval
 Prefix query searches for the longest prefix of a given
string that matches a prefix of some string in the tries
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
29
 There are variants of tries, which are listed as
follows:
 Standard tries
 Compressed trie
 Suffix tries
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
30
 The standard trie for a set of strings S is an ordered tree
such that
 Each node but the root is labelled with a character;
 The children of a node are alphabetically ordered;
 The paths from the external nodes to the oot yield the
strings of S
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
31
 Similar to the standard trie, a compressed is a tree-
based data structure
 For storing strings in order to make pattern matching
much faster
 This is an optimized approach for pattern matching
specially suitable for applications where time is a
more crucial factor
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
32
Following are the unique characteristics of
compressed tire:
 A compressed trie (or Patricia trie) has internal
nodes of degree at least 2
 It is obtained from standard trie by compressing
chains of redundant nodes
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
33
b
id u
o
ok il sh y
s
ell to
ck p
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
34
m e g h a v i n d
0 1 2 3 4 5 6 7 8
d e me
ghavind
nd
ndghavind
nd
ghavind
vind
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
35
 A suffix trie is a compressed Trie for all the suffixes
of a text
 This is a compressed Trie, and hence, possesses all
features a compressed trie and makes it more
powerful for making a search faster as it includes
all suffixes of a text
Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil
36
Ad

More Related Content

What's hot (20)

4. Recursion - Data Structures using C++ by Varsha Patil
4. Recursion - Data Structures using C++ by Varsha Patil4. Recursion - Data Structures using C++ by Varsha Patil
4. Recursion - Data Structures using C++ by Varsha Patil
widespreadpromotion
 
12. Heaps - Data Structures using C++ by Varsha Patil
12. Heaps - Data Structures using C++ by Varsha Patil12. Heaps - Data Structures using C++ by Varsha Patil
12. Heaps - Data Structures using C++ by Varsha Patil
widespreadpromotion
 
14. Files - Data Structures using C++ by Varsha Patil
14. Files - Data Structures using C++ by Varsha Patil14. Files - Data Structures using C++ by Varsha Patil
14. Files - Data Structures using C++ by Varsha Patil
widespreadpromotion
 
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
widespreadpromotion
 
15. STL - Data Structures using C++ by Varsha Patil
15. STL - Data Structures using C++ by Varsha Patil15. STL - Data Structures using C++ by Varsha Patil
15. STL - Data Structures using C++ by Varsha Patil
widespreadpromotion
 
2. Linear Data Structure Using Arrays - Data Structures using C++ by Varsha P...
2. Linear Data Structure Using Arrays - Data Structures using C++ by Varsha P...2. Linear Data Structure Using Arrays - Data Structures using C++ by Varsha P...
2. Linear Data Structure Using Arrays - Data Structures using C++ by Varsha P...
widespreadpromotion
 
Data Structure
Data StructureData Structure
Data Structure
sheraz1
 
Stacks in algorithems & data structure
Stacks in algorithems & data structureStacks in algorithems & data structure
Stacks in algorithems & data structure
faran nawaz
 
Data Structures and Algorithm - Week 4 - Trees, Binary Trees
Data Structures and Algorithm - Week 4 - Trees, Binary TreesData Structures and Algorithm - Week 4 - Trees, Binary Trees
Data Structures and Algorithm - Week 4 - Trees, Binary Trees
Ferdin Joe John Joseph PhD
 
Lecture-05-DSA
Lecture-05-DSALecture-05-DSA
Lecture-05-DSA
Haitham El-Ghareeb
 
Week 2 - Data Structures and Algorithms
Week 2 - Data Structures and AlgorithmsWeek 2 - Data Structures and Algorithms
Week 2 - Data Structures and Algorithms
Ferdin Joe John Joseph PhD
 
Data Structures and Algorithm - Week 9 - Search Algorithms
Data Structures and Algorithm - Week 9 - Search AlgorithmsData Structures and Algorithm - Week 9 - Search Algorithms
Data Structures and Algorithm - Week 9 - Search Algorithms
Ferdin Joe John Joseph PhD
 
List moderate
List   moderateList   moderate
List moderate
Rajendran
 
The D-basis Algorithm for Association Rules of High Confidence
The D-basis Algorithm for Association Rules of High ConfidenceThe D-basis Algorithm for Association Rules of High Confidence
The D-basis Algorithm for Association Rules of High Confidence
ITIIIndustries
 
Mapping Domain Names to Categories
Mapping Domain Names to CategoriesMapping Domain Names to Categories
Mapping Domain Names to Categories
Gene Chuang
 
Week 1 - Data Structures and Algorithms
Week 1 - Data Structures and AlgorithmsWeek 1 - Data Structures and Algorithms
Week 1 - Data Structures and Algorithms
Ferdin Joe John Joseph PhD
 
Data Structures and Algorithm - Week 11 - Algorithm Analysis
Data Structures and Algorithm - Week 11 - Algorithm AnalysisData Structures and Algorithm - Week 11 - Algorithm Analysis
Data Structures and Algorithm - Week 11 - Algorithm Analysis
Ferdin Joe John Joseph PhD
 
Data Structures and Algorithm - Week 8 - Minimum Spanning Trees
Data Structures and Algorithm - Week 8 - Minimum Spanning TreesData Structures and Algorithm - Week 8 - Minimum Spanning Trees
Data Structures and Algorithm - Week 8 - Minimum Spanning Trees
Ferdin Joe John Joseph PhD
 
Datastructures using c++
Datastructures using c++Datastructures using c++
Datastructures using c++
Gopi Nath
 
Data structure-question-bank
Data structure-question-bankData structure-question-bank
Data structure-question-bank
Jagan Mohan Bishoyi
 
4. Recursion - Data Structures using C++ by Varsha Patil
4. Recursion - Data Structures using C++ by Varsha Patil4. Recursion - Data Structures using C++ by Varsha Patil
4. Recursion - Data Structures using C++ by Varsha Patil
widespreadpromotion
 
12. Heaps - Data Structures using C++ by Varsha Patil
12. Heaps - Data Structures using C++ by Varsha Patil12. Heaps - Data Structures using C++ by Varsha Patil
12. Heaps - Data Structures using C++ by Varsha Patil
widespreadpromotion
 
14. Files - Data Structures using C++ by Varsha Patil
14. Files - Data Structures using C++ by Varsha Patil14. Files - Data Structures using C++ by Varsha Patil
14. Files - Data Structures using C++ by Varsha Patil
widespreadpromotion
 
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
widespreadpromotion
 
15. STL - Data Structures using C++ by Varsha Patil
15. STL - Data Structures using C++ by Varsha Patil15. STL - Data Structures using C++ by Varsha Patil
15. STL - Data Structures using C++ by Varsha Patil
widespreadpromotion
 
2. Linear Data Structure Using Arrays - Data Structures using C++ by Varsha P...
2. Linear Data Structure Using Arrays - Data Structures using C++ by Varsha P...2. Linear Data Structure Using Arrays - Data Structures using C++ by Varsha P...
2. Linear Data Structure Using Arrays - Data Structures using C++ by Varsha P...
widespreadpromotion
 
Data Structure
Data StructureData Structure
Data Structure
sheraz1
 
Stacks in algorithems & data structure
Stacks in algorithems & data structureStacks in algorithems & data structure
Stacks in algorithems & data structure
faran nawaz
 
Data Structures and Algorithm - Week 4 - Trees, Binary Trees
Data Structures and Algorithm - Week 4 - Trees, Binary TreesData Structures and Algorithm - Week 4 - Trees, Binary Trees
Data Structures and Algorithm - Week 4 - Trees, Binary Trees
Ferdin Joe John Joseph PhD
 
Data Structures and Algorithm - Week 9 - Search Algorithms
Data Structures and Algorithm - Week 9 - Search AlgorithmsData Structures and Algorithm - Week 9 - Search Algorithms
Data Structures and Algorithm - Week 9 - Search Algorithms
Ferdin Joe John Joseph PhD
 
The D-basis Algorithm for Association Rules of High Confidence
The D-basis Algorithm for Association Rules of High ConfidenceThe D-basis Algorithm for Association Rules of High Confidence
The D-basis Algorithm for Association Rules of High Confidence
ITIIIndustries
 
Mapping Domain Names to Categories
Mapping Domain Names to CategoriesMapping Domain Names to Categories
Mapping Domain Names to Categories
Gene Chuang
 
Data Structures and Algorithm - Week 11 - Algorithm Analysis
Data Structures and Algorithm - Week 11 - Algorithm AnalysisData Structures and Algorithm - Week 11 - Algorithm Analysis
Data Structures and Algorithm - Week 11 - Algorithm Analysis
Ferdin Joe John Joseph PhD
 
Data Structures and Algorithm - Week 8 - Minimum Spanning Trees
Data Structures and Algorithm - Week 8 - Minimum Spanning TreesData Structures and Algorithm - Week 8 - Minimum Spanning Trees
Data Structures and Algorithm - Week 8 - Minimum Spanning Trees
Ferdin Joe John Joseph PhD
 
Datastructures using c++
Datastructures using c++Datastructures using c++
Datastructures using c++
Gopi Nath
 

Viewers also liked (20)

Discrete Mathematics S. Lipschutz, M. Lipson And V. H. Patil
Discrete Mathematics S. Lipschutz, M. Lipson And V. H. PatilDiscrete Mathematics S. Lipschutz, M. Lipson And V. H. Patil
Discrete Mathematics S. Lipschutz, M. Lipson And V. H. Patil
widespreadpromotion
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
Vineeta Garg
 
5.3 dynamic programming
5.3 dynamic programming5.3 dynamic programming
5.3 dynamic programming
Krish_ver2
 
Lists, queues and stacks
Lists, queues and stacksLists, queues and stacks
Lists, queues and stacks
andreeamolnar
 
Array,lists and hashes in perl
Array,lists and hashes in perlArray,lists and hashes in perl
Array,lists and hashes in perl
sana mateen
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructors
Vineeta Garg
 
Classes and objects1
Classes and objects1Classes and objects1
Classes and objects1
Vineeta Garg
 
Advanced data structures using c++ 3
Advanced data structures using c++ 3Advanced data structures using c++ 3
Advanced data structures using c++ 3
Shaili Choudhary
 
Structured query language functions
Structured query language functionsStructured query language functions
Structured query language functions
Vineeta Garg
 
Structured query language constraints
Structured query language constraintsStructured query language constraints
Structured query language constraints
Vineeta Garg
 
Pp
PpPp
Pp
sheraz1
 
Selection sort
Selection sortSelection sort
Selection sort
asra khan
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
Vineeta Garg
 
Working with Cookies in NodeJS
Working with Cookies in NodeJSWorking with Cookies in NodeJS
Working with Cookies in NodeJS
Jay Dihenkar
 
Data types in c++
Data types in c++Data types in c++
Data types in c++
Venkata.Manish Reddy
 
C++ data types
C++ data typesC++ data types
C++ data types
pratikborsadiya
 
Dynamic pgmming
Dynamic pgmmingDynamic pgmming
Dynamic pgmming
Dr. C.V. Suresh Babu
 
Quick sort
Quick sortQuick sort
Quick sort
Jehat Hassan
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
Shakil Ahmed
 
Data file handling in c++
Data file handling in c++Data file handling in c++
Data file handling in c++
Vineeta Garg
 
Discrete Mathematics S. Lipschutz, M. Lipson And V. H. Patil
Discrete Mathematics S. Lipschutz, M. Lipson And V. H. PatilDiscrete Mathematics S. Lipschutz, M. Lipson And V. H. Patil
Discrete Mathematics S. Lipschutz, M. Lipson And V. H. Patil
widespreadpromotion
 
5.3 dynamic programming
5.3 dynamic programming5.3 dynamic programming
5.3 dynamic programming
Krish_ver2
 
Lists, queues and stacks
Lists, queues and stacksLists, queues and stacks
Lists, queues and stacks
andreeamolnar
 
Array,lists and hashes in perl
Array,lists and hashes in perlArray,lists and hashes in perl
Array,lists and hashes in perl
sana mateen
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructors
Vineeta Garg
 
Classes and objects1
Classes and objects1Classes and objects1
Classes and objects1
Vineeta Garg
 
Advanced data structures using c++ 3
Advanced data structures using c++ 3Advanced data structures using c++ 3
Advanced data structures using c++ 3
Shaili Choudhary
 
Structured query language functions
Structured query language functionsStructured query language functions
Structured query language functions
Vineeta Garg
 
Structured query language constraints
Structured query language constraintsStructured query language constraints
Structured query language constraints
Vineeta Garg
 
Selection sort
Selection sortSelection sort
Selection sort
asra khan
 
Working with Cookies in NodeJS
Working with Cookies in NodeJSWorking with Cookies in NodeJS
Working with Cookies in NodeJS
Jay Dihenkar
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
Shakil Ahmed
 
Data file handling in c++
Data file handling in c++Data file handling in c++
Data file handling in c++
Vineeta Garg
 
Ad

Similar to 16. Algo analysis & Design - Data Structures using C++ by Varsha Patil (20)

EE-232-LEC-01 Data_structures.pptx
EE-232-LEC-01 Data_structures.pptxEE-232-LEC-01 Data_structures.pptx
EE-232-LEC-01 Data_structures.pptx
iamultapromax
 
OR Slide
OR SlideOR Slide
OR Slide
Shreesha Shetty
 
A Review of Constraint Programming
A Review of Constraint ProgrammingA Review of Constraint Programming
A Review of Constraint Programming
Editor IJCATR
 
Discovering Novel Information with sentence Level clustering From Multi-docu...
Discovering Novel Information with sentence Level clustering  From Multi-docu...Discovering Novel Information with sentence Level clustering  From Multi-docu...
Discovering Novel Information with sentence Level clustering From Multi-docu...
irjes
 
G04124041046
G04124041046G04124041046
G04124041046
IOSR-JEN
 
01VD062009003760042.pdf
01VD062009003760042.pdf01VD062009003760042.pdf
01VD062009003760042.pdf
SunilMatsagar1
 
Algorithm Specification and Data Abstraction
Algorithm Specification and Data Abstraction Algorithm Specification and Data Abstraction
Algorithm Specification and Data Abstraction
Ashutosh Satapathy
 
6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...
6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...
6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...
Dr Arash Najmaei ( Phd., MBA, BSc)
 
Regression with Microsoft Azure & Ms Excel
Regression with Microsoft Azure & Ms ExcelRegression with Microsoft Azure & Ms Excel
Regression with Microsoft Azure & Ms Excel
Dr. Abdul Ahad Abro
 
Semantic Annotation of Documents
Semantic Annotation of DocumentsSemantic Annotation of Documents
Semantic Annotation of Documents
subash chandra
 
Cuckoo Search: Recent Advances and Applications
Cuckoo Search: Recent Advances and ApplicationsCuckoo Search: Recent Advances and Applications
Cuckoo Search: Recent Advances and Applications
Xin-She Yang
 
Ankit presentation
Ankit presentationAnkit presentation
Ankit presentation
ANKIT AGRAWAL
 
Algorithm of Dynamic Programming for Paper-Reviewer Assignment Problem
Algorithm of Dynamic Programming for Paper-Reviewer Assignment ProblemAlgorithm of Dynamic Programming for Paper-Reviewer Assignment Problem
Algorithm of Dynamic Programming for Paper-Reviewer Assignment Problem
IRJET Journal
 
A Fairness-aware Machine Learning Interface for End-to-end Discrimination Dis...
A Fairness-aware Machine Learning Interface for End-to-end Discrimination Dis...A Fairness-aware Machine Learning Interface for End-to-end Discrimination Dis...
A Fairness-aware Machine Learning Interface for End-to-end Discrimination Dis...
wajrcs
 
Experiments on Design Pattern Discovery
Experiments on Design Pattern DiscoveryExperiments on Design Pattern Discovery
Experiments on Design Pattern Discovery
Tim Menzies
 
Sample prac exam2013
Sample prac exam2013Sample prac exam2013
Sample prac exam2013
hccit
 
Analyzing the solutions of DEA through information visualization and data min...
Analyzing the solutions of DEA through information visualization and data min...Analyzing the solutions of DEA through information visualization and data min...
Analyzing the solutions of DEA through information visualization and data min...
Gurdal Ertek
 
Lec1
Lec1Lec1
Lec1
Ibrahim El-Torbany
 
LNCS 5050 - Bilevel Optimization and Machine Learning
LNCS 5050 - Bilevel Optimization and Machine LearningLNCS 5050 - Bilevel Optimization and Machine Learning
LNCS 5050 - Bilevel Optimization and Machine Learning
butest
 
EXPERT OPINION AND COHERENCE BASED TOPIC MODELING
EXPERT OPINION AND COHERENCE BASED TOPIC MODELINGEXPERT OPINION AND COHERENCE BASED TOPIC MODELING
EXPERT OPINION AND COHERENCE BASED TOPIC MODELING
ijnlc
 
EE-232-LEC-01 Data_structures.pptx
EE-232-LEC-01 Data_structures.pptxEE-232-LEC-01 Data_structures.pptx
EE-232-LEC-01 Data_structures.pptx
iamultapromax
 
A Review of Constraint Programming
A Review of Constraint ProgrammingA Review of Constraint Programming
A Review of Constraint Programming
Editor IJCATR
 
Discovering Novel Information with sentence Level clustering From Multi-docu...
Discovering Novel Information with sentence Level clustering  From Multi-docu...Discovering Novel Information with sentence Level clustering  From Multi-docu...
Discovering Novel Information with sentence Level clustering From Multi-docu...
irjes
 
G04124041046
G04124041046G04124041046
G04124041046
IOSR-JEN
 
01VD062009003760042.pdf
01VD062009003760042.pdf01VD062009003760042.pdf
01VD062009003760042.pdf
SunilMatsagar1
 
Algorithm Specification and Data Abstraction
Algorithm Specification and Data Abstraction Algorithm Specification and Data Abstraction
Algorithm Specification and Data Abstraction
Ashutosh Satapathy
 
6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...
6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...
6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...
Dr Arash Najmaei ( Phd., MBA, BSc)
 
Regression with Microsoft Azure & Ms Excel
Regression with Microsoft Azure & Ms ExcelRegression with Microsoft Azure & Ms Excel
Regression with Microsoft Azure & Ms Excel
Dr. Abdul Ahad Abro
 
Semantic Annotation of Documents
Semantic Annotation of DocumentsSemantic Annotation of Documents
Semantic Annotation of Documents
subash chandra
 
Cuckoo Search: Recent Advances and Applications
Cuckoo Search: Recent Advances and ApplicationsCuckoo Search: Recent Advances and Applications
Cuckoo Search: Recent Advances and Applications
Xin-She Yang
 
Algorithm of Dynamic Programming for Paper-Reviewer Assignment Problem
Algorithm of Dynamic Programming for Paper-Reviewer Assignment ProblemAlgorithm of Dynamic Programming for Paper-Reviewer Assignment Problem
Algorithm of Dynamic Programming for Paper-Reviewer Assignment Problem
IRJET Journal
 
A Fairness-aware Machine Learning Interface for End-to-end Discrimination Dis...
A Fairness-aware Machine Learning Interface for End-to-end Discrimination Dis...A Fairness-aware Machine Learning Interface for End-to-end Discrimination Dis...
A Fairness-aware Machine Learning Interface for End-to-end Discrimination Dis...
wajrcs
 
Experiments on Design Pattern Discovery
Experiments on Design Pattern DiscoveryExperiments on Design Pattern Discovery
Experiments on Design Pattern Discovery
Tim Menzies
 
Sample prac exam2013
Sample prac exam2013Sample prac exam2013
Sample prac exam2013
hccit
 
Analyzing the solutions of DEA through information visualization and data min...
Analyzing the solutions of DEA through information visualization and data min...Analyzing the solutions of DEA through information visualization and data min...
Analyzing the solutions of DEA through information visualization and data min...
Gurdal Ertek
 
LNCS 5050 - Bilevel Optimization and Machine Learning
LNCS 5050 - Bilevel Optimization and Machine LearningLNCS 5050 - Bilevel Optimization and Machine Learning
LNCS 5050 - Bilevel Optimization and Machine Learning
butest
 
EXPERT OPINION AND COHERENCE BASED TOPIC MODELING
EXPERT OPINION AND COHERENCE BASED TOPIC MODELINGEXPERT OPINION AND COHERENCE BASED TOPIC MODELING
EXPERT OPINION AND COHERENCE BASED TOPIC MODELING
ijnlc
 
Ad

Recently uploaded (20)

What is ETL? Difference between ETL and ELT?.pdf
What is ETL? Difference between ETL and ELT?.pdfWhat is ETL? Difference between ETL and ELT?.pdf
What is ETL? Difference between ETL and ELT?.pdf
SaikatBasu37
 
problem solving.presentation slideshow bsc nursing
problem solving.presentation slideshow bsc nursingproblem solving.presentation slideshow bsc nursing
problem solving.presentation slideshow bsc nursing
vishnudathas123
 
Storage Devices and the Mechanism of Data Storage in Audio and Visual Form
Storage Devices and the Mechanism of Data Storage in Audio and Visual FormStorage Devices and the Mechanism of Data Storage in Audio and Visual Form
Storage Devices and the Mechanism of Data Storage in Audio and Visual Form
Professional Content Writing's
 
Lagos School of Programming Final Project Updated.pdf
Lagos School of Programming Final Project Updated.pdfLagos School of Programming Final Project Updated.pdf
Lagos School of Programming Final Project Updated.pdf
benuju2016
 
Dynamics 365 Business Rules Dynamics Dynamics
Dynamics 365 Business Rules Dynamics DynamicsDynamics 365 Business Rules Dynamics Dynamics
Dynamics 365 Business Rules Dynamics Dynamics
heyoubro69
 
Day 1 MS Excel Basics #.pptxDay 1 MS Excel Basics #.pptxDay 1 MS Excel Basics...
Day 1 MS Excel Basics #.pptxDay 1 MS Excel Basics #.pptxDay 1 MS Excel Basics...Day 1 MS Excel Basics #.pptxDay 1 MS Excel Basics #.pptxDay 1 MS Excel Basics...
Day 1 MS Excel Basics #.pptxDay 1 MS Excel Basics #.pptxDay 1 MS Excel Basics...
Jayantilal Bhanushali
 
presentacion.slideshare.informáticaJuridica..pptx
presentacion.slideshare.informáticaJuridica..pptxpresentacion.slideshare.informáticaJuridica..pptx
presentacion.slideshare.informáticaJuridica..pptx
GersonVillatoro4
 
TYPES OF SOFTWARE_ A Visual Guide.pdf CA SUVIDHA CHAPLOT
TYPES OF SOFTWARE_ A Visual Guide.pdf CA SUVIDHA CHAPLOTTYPES OF SOFTWARE_ A Visual Guide.pdf CA SUVIDHA CHAPLOT
TYPES OF SOFTWARE_ A Visual Guide.pdf CA SUVIDHA CHAPLOT
CA Suvidha Chaplot
 
Introduction to systems thinking tools_Eng.pdf
Introduction to systems thinking tools_Eng.pdfIntroduction to systems thinking tools_Eng.pdf
Introduction to systems thinking tools_Eng.pdf
AbdurahmanAbd
 
Feature Engineering for Electronic Health Record Systems
Feature Engineering for Electronic Health Record SystemsFeature Engineering for Electronic Health Record Systems
Feature Engineering for Electronic Health Record Systems
Process mining Evangelist
 
Analysis of Billboards hot 100 toop five hit makers on the chart.docx
Analysis of Billboards hot 100 toop five hit makers on the chart.docxAnalysis of Billboards hot 100 toop five hit makers on the chart.docx
Analysis of Billboards hot 100 toop five hit makers on the chart.docx
hershtara1
 
Z14_IBM__APL_by_Christian_Demmer_IBM.pdf
Z14_IBM__APL_by_Christian_Demmer_IBM.pdfZ14_IBM__APL_by_Christian_Demmer_IBM.pdf
Z14_IBM__APL_by_Christian_Demmer_IBM.pdf
Fariborz Seyedloo
 
Ann Naser Nabil- Data Scientist Portfolio.pdf
Ann Naser Nabil- Data Scientist Portfolio.pdfAnn Naser Nabil- Data Scientist Portfolio.pdf
Ann Naser Nabil- Data Scientist Portfolio.pdf
আন্ নাসের নাবিল
 
AWS Certified Machine Learning Slides.pdf
AWS Certified Machine Learning Slides.pdfAWS Certified Machine Learning Slides.pdf
AWS Certified Machine Learning Slides.pdf
philsparkshome
 
Dr. Robert Krug - Expert In Artificial Intelligence
Dr. Robert Krug - Expert In Artificial IntelligenceDr. Robert Krug - Expert In Artificial Intelligence
Dr. Robert Krug - Expert In Artificial Intelligence
Dr. Robert Krug
 
Time series for yotube_1_data anlysis.pdf
Time series for yotube_1_data anlysis.pdfTime series for yotube_1_data anlysis.pdf
Time series for yotube_1_data anlysis.pdf
asmaamahmoudsaeed
 
L1_Slides_Foundational Concepts_508.pptx
L1_Slides_Foundational Concepts_508.pptxL1_Slides_Foundational Concepts_508.pptx
L1_Slides_Foundational Concepts_508.pptx
38NoopurPatel
 
AWS RDS Presentation to make concepts easy.pptx
AWS RDS Presentation to make concepts easy.pptxAWS RDS Presentation to make concepts easy.pptx
AWS RDS Presentation to make concepts easy.pptx
bharatkumarbhojwani
 
Automated Melanoma Detection via Image Processing.pptx
Automated Melanoma Detection via Image Processing.pptxAutomated Melanoma Detection via Image Processing.pptx
Automated Melanoma Detection via Image Processing.pptx
handrymaharjan23
 
AI ------------------------------ W1L2.pptx
AI ------------------------------ W1L2.pptxAI ------------------------------ W1L2.pptx
AI ------------------------------ W1L2.pptx
AyeshaJalil6
 
What is ETL? Difference between ETL and ELT?.pdf
What is ETL? Difference between ETL and ELT?.pdfWhat is ETL? Difference between ETL and ELT?.pdf
What is ETL? Difference between ETL and ELT?.pdf
SaikatBasu37
 
problem solving.presentation slideshow bsc nursing
problem solving.presentation slideshow bsc nursingproblem solving.presentation slideshow bsc nursing
problem solving.presentation slideshow bsc nursing
vishnudathas123
 
Storage Devices and the Mechanism of Data Storage in Audio and Visual Form
Storage Devices and the Mechanism of Data Storage in Audio and Visual FormStorage Devices and the Mechanism of Data Storage in Audio and Visual Form
Storage Devices and the Mechanism of Data Storage in Audio and Visual Form
Professional Content Writing's
 
Lagos School of Programming Final Project Updated.pdf
Lagos School of Programming Final Project Updated.pdfLagos School of Programming Final Project Updated.pdf
Lagos School of Programming Final Project Updated.pdf
benuju2016
 
Dynamics 365 Business Rules Dynamics Dynamics
Dynamics 365 Business Rules Dynamics DynamicsDynamics 365 Business Rules Dynamics Dynamics
Dynamics 365 Business Rules Dynamics Dynamics
heyoubro69
 
Day 1 MS Excel Basics #.pptxDay 1 MS Excel Basics #.pptxDay 1 MS Excel Basics...
Day 1 MS Excel Basics #.pptxDay 1 MS Excel Basics #.pptxDay 1 MS Excel Basics...Day 1 MS Excel Basics #.pptxDay 1 MS Excel Basics #.pptxDay 1 MS Excel Basics...
Day 1 MS Excel Basics #.pptxDay 1 MS Excel Basics #.pptxDay 1 MS Excel Basics...
Jayantilal Bhanushali
 
presentacion.slideshare.informáticaJuridica..pptx
presentacion.slideshare.informáticaJuridica..pptxpresentacion.slideshare.informáticaJuridica..pptx
presentacion.slideshare.informáticaJuridica..pptx
GersonVillatoro4
 
TYPES OF SOFTWARE_ A Visual Guide.pdf CA SUVIDHA CHAPLOT
TYPES OF SOFTWARE_ A Visual Guide.pdf CA SUVIDHA CHAPLOTTYPES OF SOFTWARE_ A Visual Guide.pdf CA SUVIDHA CHAPLOT
TYPES OF SOFTWARE_ A Visual Guide.pdf CA SUVIDHA CHAPLOT
CA Suvidha Chaplot
 
Introduction to systems thinking tools_Eng.pdf
Introduction to systems thinking tools_Eng.pdfIntroduction to systems thinking tools_Eng.pdf
Introduction to systems thinking tools_Eng.pdf
AbdurahmanAbd
 
Feature Engineering for Electronic Health Record Systems
Feature Engineering for Electronic Health Record SystemsFeature Engineering for Electronic Health Record Systems
Feature Engineering for Electronic Health Record Systems
Process mining Evangelist
 
Analysis of Billboards hot 100 toop five hit makers on the chart.docx
Analysis of Billboards hot 100 toop five hit makers on the chart.docxAnalysis of Billboards hot 100 toop five hit makers on the chart.docx
Analysis of Billboards hot 100 toop five hit makers on the chart.docx
hershtara1
 
Z14_IBM__APL_by_Christian_Demmer_IBM.pdf
Z14_IBM__APL_by_Christian_Demmer_IBM.pdfZ14_IBM__APL_by_Christian_Demmer_IBM.pdf
Z14_IBM__APL_by_Christian_Demmer_IBM.pdf
Fariborz Seyedloo
 
AWS Certified Machine Learning Slides.pdf
AWS Certified Machine Learning Slides.pdfAWS Certified Machine Learning Slides.pdf
AWS Certified Machine Learning Slides.pdf
philsparkshome
 
Dr. Robert Krug - Expert In Artificial Intelligence
Dr. Robert Krug - Expert In Artificial IntelligenceDr. Robert Krug - Expert In Artificial Intelligence
Dr. Robert Krug - Expert In Artificial Intelligence
Dr. Robert Krug
 
Time series for yotube_1_data anlysis.pdf
Time series for yotube_1_data anlysis.pdfTime series for yotube_1_data anlysis.pdf
Time series for yotube_1_data anlysis.pdf
asmaamahmoudsaeed
 
L1_Slides_Foundational Concepts_508.pptx
L1_Slides_Foundational Concepts_508.pptxL1_Slides_Foundational Concepts_508.pptx
L1_Slides_Foundational Concepts_508.pptx
38NoopurPatel
 
AWS RDS Presentation to make concepts easy.pptx
AWS RDS Presentation to make concepts easy.pptxAWS RDS Presentation to make concepts easy.pptx
AWS RDS Presentation to make concepts easy.pptx
bharatkumarbhojwani
 
Automated Melanoma Detection via Image Processing.pptx
Automated Melanoma Detection via Image Processing.pptxAutomated Melanoma Detection via Image Processing.pptx
Automated Melanoma Detection via Image Processing.pptx
handrymaharjan23
 
AI ------------------------------ W1L2.pptx
AI ------------------------------ W1L2.pptxAI ------------------------------ W1L2.pptx
AI ------------------------------ W1L2.pptx
AyeshaJalil6
 

16. Algo analysis & Design - Data Structures using C++ by Varsha Patil

  • 1. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 1
  • 2. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 2  After completing this chapter, the reader will be able to understand the following:   Basic tools needed to develop and analyze algorithms  Methods to compute the efficiency of algorithms  Ways to make a wise choice among many solutions for a given problem
  • 3. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 3 Algorithm Analysis Asymptoti c Notations (W, p, O) Big Omega (W)
  • 4. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 4 Algorithm Analysis Asymptoti c Notations (W, p, O) Big Omega (W)
  • 5. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 5  The following steps elaborate the general structure of the divide-and-conquer strategy  If the data size n of problem P is fundamental, calculate the result of P(n) and go to step 4  If the data size n of problem P is not fundamental, divide the problem P(n) into equivalent subproblems P(n1), P(n2), … P(ni) such that i ≥ 1  Apply divide-and-conquer recursively to each individual subproblem P(n1), P(n2), …,P(ni)  Combine the results of all subproblems P(n1), P(n2),…, P(ni) to get the final solution of P(n)
  • 6. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 6  At level one, only one call to a partition is made with n elements; at level two, Atmost two calls are made with elements (n - 1), and so on C(n) = O(n2)
  • 7. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 7  General  Knapsack Problem  Elements of Greedy Strategy
  • 8. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 8  To decide whether a problem can be solved using a greedy strategy, the following elements should be considered:  Greedy-choice property  Optimal substructure Greedy Method
  • 9. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 9  Greedy-choice property A problem exhibits greedy-choice property if a globally optimal solution can be arrived at by making a locally optimal greedy choice  That is, we make the choice that seems best at that time without considering the results from the sub problems
  • 10. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 10  The General Method  Elements of Dynamic Programming  Principle of Optimality  Limitations of Dynamic Programming  Knapsack Problem
  • 11. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 11  The General Method  Elements of Dynamic Programming  Principle of Optimality  Limitations of Dynamic Programming  Knapsack Problem
  • 12. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 12 A dynamic programming solution has the following three components:  Formulate the answer as a recurrence relation or a recursive algorithm  Show that the number of different instances of your recurrence is bounded by a polynomial  Specify an order of evaluation for the recurrence
  • 13. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 13 To decide whether a problem can be solved using the dynamic programming method, the following three elements of dynamic programming should be considered:   Optimal substructure  Overlapping subproblems  Memorization
  • 14. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 14  A problem exhibits optimal substructure if an optimal solution to the problem contains within it optimal solutions to subproblems  It also means that dynamic programming (and greedy method) might apply
  • 15. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 15  When a recursive algorithm revisits the same problem repeatedly, it is said that the optimization problem has overlapping sub problems  This is beneficial for dynamic programming  It solves each subproblem once and stores the answer in a table  This answer can be searched in constant time when required. This is contradictory to the divide-and-conquer strategy where a new problem is generated at each step of recursion
  • 16. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 16  A problem exhibits optimal substructure if an optimal solution to the problem contains within it optimal solutions to subproblems  It also means that dynamic programming (and greedy method) might apply
  • 17. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 17  However, it uses the control structure similar to the recursive algorithm  In a memorized recursive algorithm, an entry is maintained in a table for the solution to each subproblem  Initially, all entries contain a special value, which indicates that the entry is not yet used  For each subproblem, which is encountered for the first time, its solution is computed and stored in the table  Next time, for that subproblem, its entry is searched and the value is used  This can be implemented using hashing
  • 18. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 18  The principle of optimality states that an optimal sequence of decisions has the property that whatever the initial state and decision are, the remaining decisions must constitute an optimal decision sequence with regard to the state resulting from the first decision Principle of Optimality
  • 19. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 19  Pattern matching is the process of finding the presence of a particular string (pattern) in the given string (text) Pattern Matching
  • 20. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 20  Database search  Search engine  Text editors  Intrusion detection  Natural language processing  Feature detection in digitized images A few such applications are as follows:
  • 21. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 21 The most popular are the following: Brute-force approach Boyer–Moore algorithm Knuth–Morris–Pratt algorithm Robin–Karp algorithm Text partitioning algorithm Semi-numerical algorithm Popular techniques for string pattern search
  • 22. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 22  String : A string is a finite sequence of symbols that are chosen from a set or alphabet:  Alphabet is a set of characters or symbols  Substring: A substring or subsequence of a string is a subset of the symbols in a string where the order of elements is preserved  Suffix: A suffix of S is a substring S[i, …, m − 1], where i ranges between 0 and m − 1
  • 23. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 23  This is a simple straight forward approach based on the comparison of a pattern character by character with a string
  • 24. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 24  The steps involved in this approach are as follows:  Adjust the pattern P at beginning of the text  Start moving from left to right and compare the character of pattern to the corresponding character in text  Continue with step 2 until successful (all characters of the pattern are matched) or unsuccessful (a mismatch is detected)
  • 25. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 25  Boyer and Moore have developed an efficient pattern matching algorithm  Instead of sliding by one character to the right at a time, in Boyer–Moore approach, the sliding to the right is done in longer steps  The algorithm scans the character of pattern from right to left beginning with the rightmost character  If the text symbol compared with the rightmost pattern symbol does not occur in the pattern at all, then the pattern can be shifted by m positions (where m is length of pattern)
  • 26. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 26  The researchers Knuth, Morris, and Pattern proposed a linear time algorithm for the string matching problem  In this approach, a matching time of O(n) is achieved by avoiding comparisons with characters of T that have previously been involved in comparison with some element of the pattern P to be matched so that backtracking is avoided
  • 27. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 27  The KMP matcher finds the occurrence of the pattern P in text T and returns the number of shifts of P, after which the occurrence is found taking T, P, and prefix function p as inputs
  • 28. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 28  A compact data structure that represents a set of strings (such as all the words in a text) known as tries  A trie is a tree-based data structure for storing strings to make pattern matching faster  A trie helps in pattern matching in time that is proportional to the length of the pattern  Tries can be used to perform prefix query for information retrieval  Prefix query searches for the longest prefix of a given string that matches a prefix of some string in the tries
  • 29. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 29  There are variants of tries, which are listed as follows:  Standard tries  Compressed trie  Suffix tries
  • 30. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 30  The standard trie for a set of strings S is an ordered tree such that  Each node but the root is labelled with a character;  The children of a node are alphabetically ordered;  The paths from the external nodes to the oot yield the strings of S
  • 31. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 31  Similar to the standard trie, a compressed is a tree- based data structure  For storing strings in order to make pattern matching much faster  This is an optimized approach for pattern matching specially suitable for applications where time is a more crucial factor
  • 32. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 32 Following are the unique characteristics of compressed tire:  A compressed trie (or Patricia trie) has internal nodes of degree at least 2  It is obtained from standard trie by compressing chains of redundant nodes
  • 33. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 33 b id u o ok il sh y s ell to ck p
  • 34. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 34 m e g h a v i n d 0 1 2 3 4 5 6 7 8 d e me ghavind nd ndghavind nd ghavind vind
  • 35. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 35  A suffix trie is a compressed Trie for all the suffixes of a text  This is a compressed Trie, and hence, possesses all features a compressed trie and makes it more powerful for making a search faster as it includes all suffixes of a text
  • 36. Oxford University Press © 2012Data Structures Using C++ by Dr Varsha Patil 36
  翻译: