The document discusses the string matching algorithm that builds a finite automaton to scan a text string for occurrences of a pattern string. It explains the suffix function and transition function that are used to specify the string matching automaton corresponding to a given pattern. It then provides an example of computing the transition function for a given text and pattern string through multiple iterations.
String Matching with Finite Automata,Aho corasick,8neutron8
This document discusses string matching using finite automata, specifically the Aho-Corasick algorithm. It begins by introducing finite state machines and how they can be used for string matching. It then provides details on the Aho-Corasick algorithm, including how it constructs a pattern matching machine from keywords to search for and uses this machine to search text in one pass. It discusses the goto, failure, and output functions used and provides an example of running the algorithm on sample text and keywords.
The document discusses the Rabin-Karp algorithm for string matching. It defines Rabin-Karp as a string search algorithm that compares hash values of strings rather than the strings themselves. It explains that Rabin-Karp works by calculating a hash value for the pattern and text subsequences to compare, and only does a brute force comparison when hash values match. The worst-case complexity is O(n-m+1)m but the average case is O(n+m) plus processing spurious hits. Real-life applications include bioinformatics to find protein similarities.
This document discusses the heap data structure and heapsort algorithm. It defines a heap as a nearly complete binary tree that satisfies the heap property, where every parent node is greater than or equal to its children. It describes how to represent a heap using an array and the key operations of building a max-heap from an array, inserting and deleting nodes, and maintaining the heap property. Heapsort works by building a max-heap from the input array and then extracting elements in sorted order.
This document discusses string matching algorithms. It defines string matching as finding a pattern within a larger text or string. It then summarizes two common string matching algorithms: the naive algorithm and Rabin-Karp algorithm. The naive algorithm loops through all possible shifts of the pattern and directly compares characters. Rabin-Karp also shifts the pattern but compares hash values of substrings first before checking individual characters to reduce comparisons. The document provides examples of how each algorithm works on sample strings.
Turing Machines are a simple mathematical model of a general purpose computer invented by Alan Turing in 1936. A Turing Machine consists of an infinite tape divided into cells, a head that reads and writes symbols on the tape, a finite set of states, and transition rules determining the behavior of the machine. The machine operates by reading a symbol on the tape, updating the symbol according to its transition rules, moving the head left or right, and transitioning to a new state. Turing Machines can simulate any algorithm and are capable of performing any calculation that can be performed by any computing machine.
a graph search algorithm that solves the single-source shortest path problem for a graph with non-negative edge path costs, producing a shortest path tree. This algorithm is often used in routing and as a subroutine in other graph algorithms.
This document describes the Bellman-Ford algorithm, a single-source shortest path algorithm that can detect negative edge cycles. It provides pseudocode for the algorithm, runs through an example, discusses the relaxation equation and time/space complexity. It also lists some applications of Bellman-Ford in routing protocols and mentions some references for more information.
This document provides an overview of the Knuth-Morris-Pratt substring search algorithm. It defines the algorithm, describes its history and key components including the prefix function and KMP matcher. An example showing the step-by-step workings of the algorithm on a text and pattern is provided. The algorithm's linear runtime complexity of O(n+m) is compared to other string matching algorithms. Real-world applications including DNA sequence analysis and search engines are discussed.
String Matching with Finite Automata,Aho corasick,8neutron8
This document discusses string matching using finite automata, specifically the Aho-Corasick algorithm. It begins by introducing finite state machines and how they can be used for string matching. It then provides details on the Aho-Corasick algorithm, including how it constructs a pattern matching machine from keywords to search for and uses this machine to search text in one pass. It discusses the goto, failure, and output functions used and provides an example of running the algorithm on sample text and keywords.
The document discusses the Rabin-Karp algorithm for string matching. It defines Rabin-Karp as a string search algorithm that compares hash values of strings rather than the strings themselves. It explains that Rabin-Karp works by calculating a hash value for the pattern and text subsequences to compare, and only does a brute force comparison when hash values match. The worst-case complexity is O(n-m+1)m but the average case is O(n+m) plus processing spurious hits. Real-life applications include bioinformatics to find protein similarities.
This document discusses the heap data structure and heapsort algorithm. It defines a heap as a nearly complete binary tree that satisfies the heap property, where every parent node is greater than or equal to its children. It describes how to represent a heap using an array and the key operations of building a max-heap from an array, inserting and deleting nodes, and maintaining the heap property. Heapsort works by building a max-heap from the input array and then extracting elements in sorted order.
This document discusses string matching algorithms. It defines string matching as finding a pattern within a larger text or string. It then summarizes two common string matching algorithms: the naive algorithm and Rabin-Karp algorithm. The naive algorithm loops through all possible shifts of the pattern and directly compares characters. Rabin-Karp also shifts the pattern but compares hash values of substrings first before checking individual characters to reduce comparisons. The document provides examples of how each algorithm works on sample strings.
Turing Machines are a simple mathematical model of a general purpose computer invented by Alan Turing in 1936. A Turing Machine consists of an infinite tape divided into cells, a head that reads and writes symbols on the tape, a finite set of states, and transition rules determining the behavior of the machine. The machine operates by reading a symbol on the tape, updating the symbol according to its transition rules, moving the head left or right, and transitioning to a new state. Turing Machines can simulate any algorithm and are capable of performing any calculation that can be performed by any computing machine.
a graph search algorithm that solves the single-source shortest path problem for a graph with non-negative edge path costs, producing a shortest path tree. This algorithm is often used in routing and as a subroutine in other graph algorithms.
This document describes the Bellman-Ford algorithm, a single-source shortest path algorithm that can detect negative edge cycles. It provides pseudocode for the algorithm, runs through an example, discusses the relaxation equation and time/space complexity. It also lists some applications of Bellman-Ford in routing protocols and mentions some references for more information.
This document provides an overview of the Knuth-Morris-Pratt substring search algorithm. It defines the algorithm, describes its history and key components including the prefix function and KMP matcher. An example showing the step-by-step workings of the algorithm on a text and pattern is provided. The algorithm's linear runtime complexity of O(n+m) is compared to other string matching algorithms. Real-world applications including DNA sequence analysis and search engines are discussed.
The document summarizes three string matching algorithms: Knuth-Morris-Pratt algorithm, Boyer-Moore string search algorithm, and Bitap algorithm. It provides details on each algorithm, including an overview, inventors, pseudocode, examples, and explanations of how they work. The Knuth-Morris-Pratt algorithm uses information about the pattern string to skip previously examined characters when a mismatch occurs. The Boyer-Moore algorithm uses preprocessing of the pattern to calculate shift amounts to skip alignments. The Bitap algorithm uses a bit array and bitwise operations to efficiently compare characters.
The document discusses string matching algorithms using finite automata. It describes how a finite automaton can be constructed from a pattern to recognize matches in a text. The automaton examines each character of the text once, allowing matches to be found in linear time O(n). It also discusses the Knuth-Morris-Pratt string matching algorithm and how it precomputes shift distances to efficiently skip over parts of the text.
The document discusses regular expressions and how they can be used to represent languages accepted by finite automata. It provides examples of how to:
1. Construct regular expressions from languages and finite state automata. Regular expressions can be built by defining expressions for subparts of a language and combining them.
2. Convert finite state automata to equivalent regular expressions using state elimination techniques. Intermediate states are replaced with regular expressions on transitions until a single state automaton remains.
3. Convert regular expressions to equivalent finite state automata by building epsilon-nondeterministic finite automata (ε-NFAs) based on the structure of the regular expression.
This document discusses and compares several algorithms for string matching:
1. The naive algorithm compares characters one by one and has O(mn) runtime, where m and n are the lengths of the pattern and text.
2. Rabin-Karp uses hashing to compare substrings, running in O(m+n) time. It calculates hash values for the pattern and text substrings.
3. Knuth-Morris-Pratt improves on naive by using the prefix function to avoid re-checking characters, running in O(m+n) time. It constructs a state machine from the pattern to skip matching.
Pushdown automata are computational models that extend finite automata with a stack, allowing them to recognize context-free languages. They consist of a finite state control unit, an input tape, and an infinite stack that supports push and pop operations, making them more powerful than finite state machines. Pushdown automata provide a way to implement context-free grammars similarly to how finite automata are used for regular grammars.
The document discusses pushdown automata (PDA). It defines a PDA as a 7-tuple that includes a set of states, input alphabet, stack alphabet, initial/start state, starting stack symbol, set of final/accepting states, and a transition function. PDAs operate on an input tape with a stack, and can accept languages that finite automata cannot, such as anbn. The document provides examples of designing PDAs for specific languages and converting between context-free grammars and PDAs.
The document discusses the Knuth-Morris-Pratt string matching algorithm. It begins with an explanation of the string matching problem and an inefficient O(mn) solution. It then introduces the KMP algorithm which uses a prefix function to avoid repeating comparisons, solving the problem in linear O(n) time. The prefix function is computed by analyzing shifts of the pattern against itself. The KMP matcher uses the prefix function to efficiently search the string without backtracking.
RABIN KARP algorithm with hash function and hash collision, analysis, algorithm and code for implementation. Besides it contains applications of RABIN KARP algorithm also
This document discusses and defines four common algorithms for string matching:
1. The naive algorithm compares characters one by one with a time complexity of O(MN).
2. The Knuth-Morris-Pratt (KMP) algorithm uses pattern preprocessing to skip previously checked characters, achieving linear time complexity of O(N+M).
3. The Boyer-Moore (BM) algorithm matches strings from right to left and uses pattern preprocessing tables to skip more characters than KMP, with sublinear worst-case time complexity of O(N/M).
4. The Rabin-Karp (RK) algorithm uses hashing techniques to find matches in text substrings, with time complexity of
NP completeness. Classes P and NP are two frequently studied classes of problems in computer science. Class P is the set of all problems that can be solved by a deterministic Turing machine in polynomial time.
The document describes the Bellman-Ford algorithm for finding the shortest paths in a graph. It begins by defining the shortest path problem and describing applications that can be modeled as shortest path problems, such as network routing. It then explains that Bellman-Ford can find single-source shortest paths in graphs with positive or negative edge weights, unlike Dijkstra's algorithm which only works for positive edges. The core of the algorithm uses relaxation to iteratively update the shortest path estimates over multiple rounds until convergence. Pseudocode is provided to demonstrate how the relaxation process is repeated for all edges |V|-1 times to find a shortest path from the source node to all other nodes.
The document discusses finite automata including nondeterministic finite automata (NFAs) and deterministic finite automata (DFAs). It provides examples of NFAs and DFAs that recognize particular strings, including strings containing certain substrings. It also gives examples of DFA state machines and discusses using finite automata to recognize regular languages.
This presentation introduces pushdown automata (PDA). A PDA is a nondeterministic finite state automaton that has an additional stack. It can perform epsilon transitions and manipulate symbols on the stack. PDAs have states, an initial stack symbol, and transitions that can pop, push or replace symbols on the stack. The presentation provides an example of a nondeterministic PDA and traces its execution on an input string to demonstrate how it works. A string is accepted if the PDA reaches a final state after consuming all input, regardless of the stack contents.
The document discusses the conversion of nondeterministic finite automata (NFA) to deterministic finite automata (DFA). It defines NFAs, including how they allow multiple transition options from each state, unlike DFAs which only allow one transition. It also describes how an NFA accepts a string if any sequence of transitions leads to an accepting state. The document then explains that any language accepted by an NFA can also be accepted by an equivalent DFA, which is constructed by using the power set of the NFA states as the DFA states.
This document discusses converting non-deterministic finite automata (NFA) to deterministic finite automata (DFA). NFAs can have multiple transitions with the same symbol or no transition for a symbol, while DFAs have a single transition for each symbol. The document provides examples of NFAs and their representations, and explains how to systematically construct a DFA that accepts the same language as a given NFA by considering all possible state combinations in the NFA. It also notes that NFAs and DFAs have equal expressive power despite their differences, and discusses minimizing DFAs and relationships to other automata models.
The document discusses the Boyer-Moore string searching algorithm. It works by preprocessing the pattern string and comparing characters from right to left. If a mismatch occurs, it uses two heuristics - bad character and good suffix - to determine the shift amount. The bad character heuristic shifts past mismatching characters, while the good suffix heuristic looks for matching suffixes to allow larger shifts. The algorithm generally gets faster as the pattern length increases, running in sub-linear time on average. It has applications in tasks like virus scanning and database searching that require high-speed string searching.
Natural Language processing Parts of speech tagging, its classes, and how to ...Rajnish Raj
Part of speech (POS) tagging is the process of assigning a part of speech tag like noun, verb, adjective to each word in a sentence. It involves determining the most likely tag sequence given the probabilities of tags occurring before or after other tags, and words occurring with certain tags. POS tagging is the first step in many NLP applications and helps determine the grammatical role of words. It involves calculating bigram and lexical probabilities from annotated corpora to find the tag sequence with the highest joint probability.
The Knuth-Morris-Pratt algorithm is a linear-time string matching algorithm that improves on the naive algorithm. It works by preprocessing the pattern string to determine where matches can continue after a mismatch. This allows it to avoid re-examining characters. The algorithm computes a prefix function during preprocessing to determine the size of the longest prefix that is also a suffix. It then uses this information to efficiently determine where to continue matching after a mismatch by avoiding backtracking.
This document discusses mathematical foundations of computer science. It covers topics such as statements (propositions), logic operators (NOT, AND, OR), compound statements, logical equivalence, conditional statements, and arguments. Specifically, it defines statements as sentences that are either true or false. It introduces logic operators and how they can be used to construct new statements from old ones. It also discusses logical forms such as truth tables and De Morgan's laws. Finally, it discusses conditional statements, logical equivalence, and valid arguments.
This document discusses finite automata and regular languages. It defines finite automata using a 5-tuple notation and provides examples of automata and their accepted languages. It also covers nondeterministic finite automata and shows regular languages are closed under operations like union, concatenation and star.
This document summarizes Noam Chomsky's 1957 work defining the Chomsky hierarchy of formal languages. It introduces the four types of grammars - Type-3 (regular), Type-2 (context-free), Type-1 (context-sensitive), and Type-0 (recursively enumerable) - and describes their defining production rules. Context-free grammars, which generate context-free languages, are discussed in more detail. Examples are provided to illustrate context-free grammars and their ability to generate non-regular languages like {anbn}. Pushdown automata, which are equivalent to context-free grammars, are also introduced.
The document summarizes three string matching algorithms: Knuth-Morris-Pratt algorithm, Boyer-Moore string search algorithm, and Bitap algorithm. It provides details on each algorithm, including an overview, inventors, pseudocode, examples, and explanations of how they work. The Knuth-Morris-Pratt algorithm uses information about the pattern string to skip previously examined characters when a mismatch occurs. The Boyer-Moore algorithm uses preprocessing of the pattern to calculate shift amounts to skip alignments. The Bitap algorithm uses a bit array and bitwise operations to efficiently compare characters.
The document discusses string matching algorithms using finite automata. It describes how a finite automaton can be constructed from a pattern to recognize matches in a text. The automaton examines each character of the text once, allowing matches to be found in linear time O(n). It also discusses the Knuth-Morris-Pratt string matching algorithm and how it precomputes shift distances to efficiently skip over parts of the text.
The document discusses regular expressions and how they can be used to represent languages accepted by finite automata. It provides examples of how to:
1. Construct regular expressions from languages and finite state automata. Regular expressions can be built by defining expressions for subparts of a language and combining them.
2. Convert finite state automata to equivalent regular expressions using state elimination techniques. Intermediate states are replaced with regular expressions on transitions until a single state automaton remains.
3. Convert regular expressions to equivalent finite state automata by building epsilon-nondeterministic finite automata (ε-NFAs) based on the structure of the regular expression.
This document discusses and compares several algorithms for string matching:
1. The naive algorithm compares characters one by one and has O(mn) runtime, where m and n are the lengths of the pattern and text.
2. Rabin-Karp uses hashing to compare substrings, running in O(m+n) time. It calculates hash values for the pattern and text substrings.
3. Knuth-Morris-Pratt improves on naive by using the prefix function to avoid re-checking characters, running in O(m+n) time. It constructs a state machine from the pattern to skip matching.
Pushdown automata are computational models that extend finite automata with a stack, allowing them to recognize context-free languages. They consist of a finite state control unit, an input tape, and an infinite stack that supports push and pop operations, making them more powerful than finite state machines. Pushdown automata provide a way to implement context-free grammars similarly to how finite automata are used for regular grammars.
The document discusses pushdown automata (PDA). It defines a PDA as a 7-tuple that includes a set of states, input alphabet, stack alphabet, initial/start state, starting stack symbol, set of final/accepting states, and a transition function. PDAs operate on an input tape with a stack, and can accept languages that finite automata cannot, such as anbn. The document provides examples of designing PDAs for specific languages and converting between context-free grammars and PDAs.
The document discusses the Knuth-Morris-Pratt string matching algorithm. It begins with an explanation of the string matching problem and an inefficient O(mn) solution. It then introduces the KMP algorithm which uses a prefix function to avoid repeating comparisons, solving the problem in linear O(n) time. The prefix function is computed by analyzing shifts of the pattern against itself. The KMP matcher uses the prefix function to efficiently search the string without backtracking.
RABIN KARP algorithm with hash function and hash collision, analysis, algorithm and code for implementation. Besides it contains applications of RABIN KARP algorithm also
This document discusses and defines four common algorithms for string matching:
1. The naive algorithm compares characters one by one with a time complexity of O(MN).
2. The Knuth-Morris-Pratt (KMP) algorithm uses pattern preprocessing to skip previously checked characters, achieving linear time complexity of O(N+M).
3. The Boyer-Moore (BM) algorithm matches strings from right to left and uses pattern preprocessing tables to skip more characters than KMP, with sublinear worst-case time complexity of O(N/M).
4. The Rabin-Karp (RK) algorithm uses hashing techniques to find matches in text substrings, with time complexity of
NP completeness. Classes P and NP are two frequently studied classes of problems in computer science. Class P is the set of all problems that can be solved by a deterministic Turing machine in polynomial time.
The document describes the Bellman-Ford algorithm for finding the shortest paths in a graph. It begins by defining the shortest path problem and describing applications that can be modeled as shortest path problems, such as network routing. It then explains that Bellman-Ford can find single-source shortest paths in graphs with positive or negative edge weights, unlike Dijkstra's algorithm which only works for positive edges. The core of the algorithm uses relaxation to iteratively update the shortest path estimates over multiple rounds until convergence. Pseudocode is provided to demonstrate how the relaxation process is repeated for all edges |V|-1 times to find a shortest path from the source node to all other nodes.
The document discusses finite automata including nondeterministic finite automata (NFAs) and deterministic finite automata (DFAs). It provides examples of NFAs and DFAs that recognize particular strings, including strings containing certain substrings. It also gives examples of DFA state machines and discusses using finite automata to recognize regular languages.
This presentation introduces pushdown automata (PDA). A PDA is a nondeterministic finite state automaton that has an additional stack. It can perform epsilon transitions and manipulate symbols on the stack. PDAs have states, an initial stack symbol, and transitions that can pop, push or replace symbols on the stack. The presentation provides an example of a nondeterministic PDA and traces its execution on an input string to demonstrate how it works. A string is accepted if the PDA reaches a final state after consuming all input, regardless of the stack contents.
The document discusses the conversion of nondeterministic finite automata (NFA) to deterministic finite automata (DFA). It defines NFAs, including how they allow multiple transition options from each state, unlike DFAs which only allow one transition. It also describes how an NFA accepts a string if any sequence of transitions leads to an accepting state. The document then explains that any language accepted by an NFA can also be accepted by an equivalent DFA, which is constructed by using the power set of the NFA states as the DFA states.
This document discusses converting non-deterministic finite automata (NFA) to deterministic finite automata (DFA). NFAs can have multiple transitions with the same symbol or no transition for a symbol, while DFAs have a single transition for each symbol. The document provides examples of NFAs and their representations, and explains how to systematically construct a DFA that accepts the same language as a given NFA by considering all possible state combinations in the NFA. It also notes that NFAs and DFAs have equal expressive power despite their differences, and discusses minimizing DFAs and relationships to other automata models.
The document discusses the Boyer-Moore string searching algorithm. It works by preprocessing the pattern string and comparing characters from right to left. If a mismatch occurs, it uses two heuristics - bad character and good suffix - to determine the shift amount. The bad character heuristic shifts past mismatching characters, while the good suffix heuristic looks for matching suffixes to allow larger shifts. The algorithm generally gets faster as the pattern length increases, running in sub-linear time on average. It has applications in tasks like virus scanning and database searching that require high-speed string searching.
Natural Language processing Parts of speech tagging, its classes, and how to ...Rajnish Raj
Part of speech (POS) tagging is the process of assigning a part of speech tag like noun, verb, adjective to each word in a sentence. It involves determining the most likely tag sequence given the probabilities of tags occurring before or after other tags, and words occurring with certain tags. POS tagging is the first step in many NLP applications and helps determine the grammatical role of words. It involves calculating bigram and lexical probabilities from annotated corpora to find the tag sequence with the highest joint probability.
The Knuth-Morris-Pratt algorithm is a linear-time string matching algorithm that improves on the naive algorithm. It works by preprocessing the pattern string to determine where matches can continue after a mismatch. This allows it to avoid re-examining characters. The algorithm computes a prefix function during preprocessing to determine the size of the longest prefix that is also a suffix. It then uses this information to efficiently determine where to continue matching after a mismatch by avoiding backtracking.
This document discusses mathematical foundations of computer science. It covers topics such as statements (propositions), logic operators (NOT, AND, OR), compound statements, logical equivalence, conditional statements, and arguments. Specifically, it defines statements as sentences that are either true or false. It introduces logic operators and how they can be used to construct new statements from old ones. It also discusses logical forms such as truth tables and De Morgan's laws. Finally, it discusses conditional statements, logical equivalence, and valid arguments.
This document discusses finite automata and regular languages. It defines finite automata using a 5-tuple notation and provides examples of automata and their accepted languages. It also covers nondeterministic finite automata and shows regular languages are closed under operations like union, concatenation and star.
This document summarizes Noam Chomsky's 1957 work defining the Chomsky hierarchy of formal languages. It introduces the four types of grammars - Type-3 (regular), Type-2 (context-free), Type-1 (context-sensitive), and Type-0 (recursively enumerable) - and describes their defining production rules. Context-free grammars, which generate context-free languages, are discussed in more detail. Examples are provided to illustrate context-free grammars and their ability to generate non-regular languages like {anbn}. Pushdown automata, which are equivalent to context-free grammars, are also introduced.
Simplifies and normal forms - Theory of ComputationNikhil Pandit
1) The document discusses simplifying context-free grammars (CFGs) and putting them into normal form.
2) It describes eliminating null productions, unit productions, and useless productions to simplify CFGs.
3) It then explains Greibach normal form, where all productions are of the form A→αX, with A a nonterminal, α a terminal, and X a string of nonterminals. An algorithm is provided to convert CFGs to Greibach normal form.
Context-free grammars are a notation for describing languages using variables and productions. They are more powerful than regular expressions but still cannot define all possible languages. A context-free grammar consists of terminals, variables, a start symbol, and productions. Strings in the language are derived by replacing variables according to productions until only terminals remain. Leftmost and rightmost derivations restrict replacements to specific variables.
Context free grammars (CFGs) are formal systems that describe the structure of languages. A CFG consists of variables, terminals, production rules, and a start variable. Production rules take the form of a single variable producing a string of terminals and/or variables. CFGs can capture the recursive structure of natural languages while ignoring agreement and reference. They are used to define context-free languages and generate parse trees. Ambiguous grammars have sentences with multiple parse trees, and disambiguation aims to impose an ordering on derivations. While ambiguity cannot always be eliminated, simplifying and restricting grammars has theoretical and practical benefits.
The document discusses deterministic finite automata (DFAs) and regular languages. It provides examples of DFA diagrams and explains how to test if a DFA accepts a given string. It also discusses properties of regular languages, including that they are closed under union, intersection, and negation. The document uses the pigeonhole principle to prove that the language of strings with an equal number of 'a's and 'b's is not a regular language.
This document discusses regular expressions and finite automata. It begins by defining regular expressions, which are sequences of characters that define search patterns. It then discusses how regular expressions are used to define formal languages and how finite automata can be constructed to recognize these languages. Specific topics covered include the definition of regular expressions, building regular expressions, constructing finite automata from regular expressions, applying Arden's theorem to find regular expressions from finite automata, and proving languages are non-regular using the pumping lemma. Examples are provided to demonstrate how to construct finite automata from regular expressions and apply these concepts.
1. Automata theory is the study of abstract machines and the problems they are able to solve. It is closely related to formal language theory as automata are often classified by the formal languages they can recognize.
2. A finite automaton is an abstract machine that consists of a finite number of states. It reads an input string and based on its current state and the next input symbol, transitions to the next state according to its transition function. If it ends in an accepting state, the input is accepted.
3. Deterministic finite automata (DFAs) are a type of finite automaton where the transition function maps each state-symbol pair to a unique next state. DFAs can be represented
Lecture: Regular Expressions and Regular LanguagesMarina Santini
This document provides an introduction to regular expressions and regular languages. It defines the key operations used in regular expressions: union, concatenation, and Kleene star. It explains how regular expressions can be converted into finite state automata and vice versa. Examples of regular expressions are provided. The document also defines regular languages as those languages that can be accepted by a deterministic finite automaton. It introduces the pumping lemma as a way to determine if a language is not regular. Finally, it includes some practical activities for readers to practice converting regular expressions to automata and writing regular expressions.
1. The document describes a game theory model with multiple players and outcomes.
2. Equilibrium conditions for the players' strategies are derived by setting each player's payoff equal across different strategy choices.
3. The solutions to the equilibrium conditions are found to be mixed strategies with probabilities of 1/2, 1/3, and 3/4 for some players' strategies.
1) The document presents solutions to two optimization problems involving functions F1 and sets P1, P2.
2) It finds the optimal values of p1, p2 that minimize/maximize F1 over the sets. This involves analyzing F1 for different ranges of p and q.
3) The solutions are presented in tables listing the optimal p1, p2 values and the minimum/maximum value of F1.
Learning Algorithms For Life ScientistsBrian Frezza
This was a very brief introduction to the basics of learning algorithms for life scientists I was asked to give to the incoming first year students at TSRI in the fall of 2005. It covers the very basics of how the algorithms work (sans the complex math) and more importantly, how they can be appropriately understood and applied by chemists and biologists.
1) The document contains mathematical formulas and equations.
2) It discusses topics like minimizing and maximizing functions over different variables and parameter spaces.
3) The overall goal seems to be analyzing optimization problems and finding optimal solutions through analyzing functions of multiple variables.
The document describes a game theory model with three players (N={1,2,3}) and strategies. Each player i has a set of possible strategies Pi and receives payoff according to function Fi. Equilibrium strategies (p1*, p2*, p3*) are derived by finding values that maximize each player's payoff given other players' strategies. Specifically:
1. The players' strategy sets and payoff functions F1, F2, F3 are defined in terms of probabilities p, q, r.
2. Equilibrium strategies are obtained by solving the systems of equations F1=F2, F2=F3, F1=F3.
3. This yields
Randomized smoothing is a method to make a classifier robust against adversarial attacks. I introduce two papers to improve the performance of a method using randomized smoothing technique.
1. The document describes two experts, Expert A and Expert B, that provide probabilities for outcomes.
2. Expert A assigns probabilities to outcomes based on parameters p, q, and x. Expert B assigns probabilities based on observing Expert A's probabilities and parameters.
3. The document analyzes when the expected values of the outcomes are maximized for each expert to determine conditions on the parameters p, q, and x.
Hidden Markov models can be used to model sequential data and detect patterns. The document describes an HMM to detect CpG islands in DNA sequences. It has two states, "CpG island" and "not CpG island". Transition and emission probabilities are estimated from training data. The Viterbi, forward-backward, and Baum-Welch algorithms are used to find the most likely state sequence and re-estimate parameters when the true state sequence is unknown. The model can be extended to higher-order HMMs and different state duration distributions.
Quicksort is a divide and conquer algorithm that works by partitioning an array around a pivot value and recursively sorting the subarrays. It has the following steps:
1. Pick a pivot element and partition the array into two halves based on element values relative to the pivot.
2. Recursively sort the two subarrays using quicksort.
3. The entire array is now sorted after sorting the subarrays.
The worst case occurs when the array is already sorted or reverse sorted, taking O(n^2) time due to linear-time partitioning at each step. The average and best cases take O(nlogn) time as the array is typically partitioned close to evenly.
The document discusses resource allocation among users. It first defines the utility function for each user i as πi, which depends on resource allocation qi and other users' allocations. It shows πi is concave in qi. It then proves the existence of a Nash equilibrium allocation that maximizes each user's utility given others' allocations. The allocation satisfies the first order condition that the derivative of each user's utility with respect to its own allocation is non-positive.
it is the first Homework.
it is about..
1-)The Foundations: Logic and Proofs
2-)Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
3-)Number Theory and Cryptography
4-)Induction and Recursion
This document outlines a model for profit functions πi(pi) for firms i based on their price pi. It considers different cases where pi is above, below, or equal to competitors' prices pj and the minimum cost c. It finds the optimal price is p* where πi(p*) is maximized. It then shows that undercutting p* slightly to p*-1 results in profits π' that are nearly double π*, indicating p* is the unique pure strategy Nash equilibrium.
Globant development week / Lamda & Functional ProgramingGlobant
The document discusses lambda calculus and functional programming using combinators. It introduces several basic combinators like I, K, S and shows how they can be combined to represent other functions. It also discusses Church encodings for representing booleans, numbers, pairs and other data types using combinators. Finally, it provides some potential reasons for studying combinatory logic like its ability to encode any computation and serve as a basis for functional programming.
The document discusses control as inference in Markov decision processes (MDPs) and partially observable MDPs (POMDPs). It introduces optimality variables that represent whether a state-action pair is optimal or not. It formulates the optimal action-value function Q* and optimal value function V* in terms of these optimality variables and the reward and transition distributions. Q* is defined as the log probability of a state-action pair being optimal, and V* is defined as the log probability of a state being optimal. Bellman equations are derived relating Q* and V* to the reward and next state value.
Here are my slides in some basic algorithms in Computational Geometry:
1.- Line Intersection
2.- Sweeping Line
3.- Convex Hull
They are the classic one, but there is still a lot for anybody wanting to get in computer graphics to study. I recomend
Mark de Berg, Otfried Cheong, Marc van Kreveld, and Mark Overmars. 2008. Computational Geometry: Algorithms and Applications (3rd ed. ed.). TELOS, Santa Clara, CA, USA.
The document discusses probability distributions and Bayesian inference. It provides two probability distributions with four possible outcomes each. It then performs calculations to find the probabilities associated with each outcome and compares the results to determine the most likely distribution.
The document describes the steps of chart parsing using features. It discusses reading the grammar agenda and lexicon in the first step. In the second step, it forms active arcs by applying grammar rules to incomplete arcs. In the third step, it places the read arcs in the chart.
This document provides tables of Laplace transforms for various functions including:
- General formulas for Laplace transforms
- Expressions involving power-law functions
- Expressions involving exponential functions
- Expressions involving hyperbolic functions
- Expressions involving logarithmic functions
For each function, the original function f(x) is provided along with its corresponding Laplace transform f(p). References for further information on Laplace transforms are also included.
Similar to String matching with finite state automata (20)
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxEduSkills OECD
Iván Bornacelly, Policy Analyst at the OECD Centre for Skills, OECD, presents at the webinar 'Tackling job market gaps with a skills-first approach' on 12 June 2024
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.pptHenry Hollis
The History of NZ 1870-1900.
Making of a Nation.
From the NZ Wars to Liberals,
Richard Seddon, George Grey,
Social Laboratory, New Zealand,
Confiscations, Kotahitanga, Kingitanga, Parliament, Suffrage, Repudiation, Economic Change, Agriculture, Gold Mining, Timber, Flax, Sheep, Dairying,
Gender and Mental Health - Counselling and Family Therapy Applications and In...PsychoTech Services
A proprietary approach developed by bringing together the best of learning theories from Psychology, design principles from the world of visualization, and pedagogical methods from over a decade of training experience, that enables you to: Learn better, faster!
This document provides an overview of wound healing, its functions, stages, mechanisms, factors affecting it, and complications.
A wound is a break in the integrity of the skin or tissues, which may be associated with disruption of the structure and function.
Healing is the body’s response to injury in an attempt to restore normal structure and functions.
Healing can occur in two ways: Regeneration and Repair
There are 4 phases of wound healing: hemostasis, inflammation, proliferation, and remodeling. This document also describes the mechanism of wound healing. Factors that affect healing include infection, uncontrolled diabetes, poor nutrition, age, anemia, the presence of foreign bodies, etc.
Complications of wound healing like infection, hyperpigmentation of scar, contractures, and keloid formation.
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
How to Setup Warehouse & Location in Odoo 17 InventoryCeline George
In this slide, we'll explore how to set up warehouses and locations in Odoo 17 Inventory. This will help us manage our stock effectively, track inventory levels, and streamline warehouse operations.
3. STRING MATCHING WITH
FINITE AUTOMATA:
• String matching algorithm builds a finite
automaton
• A simple machine for processing information
that scans the text string T for all occurrences of
the pattern P
7. STRING
MATCHING
AUTOMATA
(SUFFIX
FUNCTION):• In order to specify the string-matching automaton
corresponding to a given pattern P[1…m]
• An auxiliary function σ, called the suffix function
corresponding to P
• The function σ maps * to {0,1,…..,m} such thatƩ
σ(x) is the length of the longest prefix of P that is
also a suffix of x:
• σ(x) = max{k: Pk ⊐x}
11. COMPUTE TRANSITION
FUNCTION:
• TEXT=abababacaba
• PATTERN=ababaca
• ={a,b,c}Ʃ
Compute transition
function(P, )Ʃ
1 m← length[P]
m← 7
2 for q←0 to m
for q←0 to 7
3 do for each character aєƩ
// ={a,b,c}Ʃ
12. 1st
ITERATION:
q=0, a=a
3. for each character aєa
4. k←min(m+1,q+2)
= min(7+1,0+2)=2
K←2
7. Pk Pqa= P2 P0a⊐ ⊐
(ab a) FALSE⊐
K←1
7.Pk Pqa= P1 P0a⊐ ⊐
(a a) TRUE⊐
8. δ(q,a)←k
δ(0,a)←1
state a b c P
0 1 a
1 b
2 a
3 b
4 a
5 c
6 a
7
13. CONT…
q=0
3. for each character aєb
4. K=2
7. Pk Pqa=P2 P0a⊐ ⊐
(ab b) FALSE⊐
K=1
7.Pk Pqa=P1 P0a⊐ ⊐
(a b) FALSE⊐
K=0
Pk Pqa=P0 P0b⊐ ⊐
(є b) TRUE⊐
8.δ(q,a)←k
δ(0,b)←0
state a b c P
0 1 0 a
1 b
2 a
3 b
4 a
5 c
6 a
7
14. CONT…
q=0
3. for each character aєc
4. K=2
7. Pk Pqa=P2 P0a⊐ ⊐
(ab c) FALSE⊐
K=1
7.Pk Pqa=P1 P0a⊐ ⊐
(a c) FALSE⊐
K=0
Pk Pqa=P0 P0s⊐ ⊐
(є c) TRUE⊐
8.δ(q,a)←k
δ(0,c)←0
state a b c P
0 1 0 0 a
1 b
2 a
3 b
4 a
5 c
6 a
7
15. 2nd
ITERATION:
2.for q←1 to 7
3.for each character aє(a,b,c)
q=1,a=a
4.k←min(m+1,q+2)=min(7+1,1
+2)=3
K←3
Pk Pqa=P3 P1a=(aba aa)⊐ ⊐ ⊐
FALSE
k←2
7. Pk Pqa=P2 P1a⊐ ⊐
(ab aa) FALSE⊐
K=1
7.Pk Pqa=P1 P1a⊐ ⊐
(a aa) TRUE⊐
8.δ(q,a)←k
δ(1,a)←1
State a b c P
0 1 0 0 a
1 1 b
2 a
3 b
4 a
5 c
6 a
7
16. CONT…
q=1
for each character aєb
4.K←3
Pk Pqa=P3 P1a=(aba ab)⊐ ⊐ ⊐
FALSE
k←2
7. Pk Pqa=P2 P1a⊐ ⊐
(ab ab) TRUE⊐
8.δ(1,b) 2←
State a b c P
0 1 0 0 a
1 1 2 b
2 a
3 b
4 a
5 c
6 a
7
17. CONT…
q=1
for each character aєc
4.K←3
Pk Pqa=P3 P1a=(aba ac)⊐ ⊐ ⊐
FALSE
k←2
7. Pk Pqa=P2 P1a⊐ ⊐
(ab ac) FALSE⊐
k 1←
Pk Pqa=P1 P1a⊐ ⊐
(a ac) FALSE⊐
k 0←
Pk Pqa=P0 P1a⊐ ⊐
(є ac) TRUE⊐
8.δ(1,c)←0
State a b c P
0 1 0 0 a
1 1 2 0 b
2 a
3 b
4 a
5 c
6 a
7
18. 3rd
ITERATION:
2.for q←2 to 7
3.for each character aє(a,b,c)
q=2,a=a
4.k←min(m+1,q+2)=min(8,4)=4
K←4
Pk Pqa=P4 P2a=(abab aba)⊐ ⊐ ⊐
FALSE
Pk Pqa=P3 P2a=(aba aba)⊐ ⊐ ⊐
TRUE
8.δ(q,a)←k
δ(2,a)←3
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 a
3 b
4 a
5 c
6 a
7
19. CONT…
q=2
for each character aєb
K 4←
Pk Pqa=P4 P2a=(abab abb)⊐ ⊐ ⊐
FALSE
K=3
Pk Pqa=P3 P2a=(aba abb)⊐ ⊐ ⊐
FALSE
k←2
7. Pk Pqa=P2 P2a =(ab abb)⊐ ⊐ ⊐
FALSE
K=1
7.Pk Pqa=P1 P2a⊐ ⊐
(a abb) FALSE⊐
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 a
3 b
4 a
5 c
6 a
7
K=0
7.Pk Pqa=P0 P2a⊐ ⊐
(є abb)TRUE⊐
8.δ(q,a)←k
δ(2,b)←0
20. CONT…
q=2
for each character aєc
K 4←
Pk Pqa=P4 P2a=(abab abc)⊐ ⊐ ⊐
FALSE
K=3
Pk Pqa=P3 P2a=(aba abc)⊐ ⊐ ⊐
FALSE
k←2
7. Pk Pqa=P2 P2a =(ab abc)⊐ ⊐ ⊐
FALSE
K=1
7.Pk Pqa=P1 P2a⊐ ⊐
(a abc) FALSE⊐
K=0
7.Pk Pqa=P0 P2a⊐ ⊐
(є abc)TRUE⊐
8.δ(q,a)←k
δ(2,c)←0
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 b
4 a
5 c
6 a
7
21. 4TH
ITERATION: K 1←
Pk Pqa=P1 P3a=(a abaa)⊐ ⊐ ⊐
TRUE
8.δ(q,a)←k
δ(3,a)←1
2.for q←3 to 7
3.for each character aє(a,b,c)
q=3,a=a
4.k←min(m+1,q+2)=min(8,4)=4
K←5
Pk Pqa=P5 P3a=(ababa abaa)⊐ ⊐ ⊐
FALSE
k←4
Pk Pqa=P4 P3a=(abab abaa)⊐ ⊐ ⊐
FALSE
K←3
Pk Pqa=P3 P3a=(aba abaa)⊐ ⊐ ⊐
FALSE
k←2
Pk Pqa=P2 P3a=(ab abaa)⊐ ⊐ ⊐
FALSE
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 b
4 a
5 c
6 a
7
22. CONT…
2.for q←3
3.for each character aєb
K←5
Pk
Pqa=P5 P3a=(ababa abab)⊐ ⊐ ⊐
FALSE
k←4
Pk Pqa=P4 P3a=(abab abab)⊐ ⊐ ⊐
TRUE
8.δ(q,a)←k
δ(3,b)←4
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 b
4 a
5 c
6 a
7
23. CONT…
2.q=3
3.for each character aєc
K←5
Pk Pqa=P5 P3a=(ababa abac)⊐ ⊐ ⊐
FALSE
k←4
Pk Pqa=P4 P3a=(abab abac)⊐ ⊐ ⊐
FALSE
K←3
Pk Pqa=P3 P3a=(aba abac)⊐ ⊐ ⊐
FALSE
k←2
Pk Pqa=P2 P3a=(ab abac)⊐ ⊐ ⊐
FALSE
K←1
Pk Pqa=P1 P3a=(a abac)⊐ ⊐ ⊐
FALSE
K←0
Pk Pqa=P0 P3a=(⊐ ⊐ є abac)⊐
TRUE
8.δ(q,a)←k
δ(3,c)←0
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 0 b
4 a
5 c
6 a
7
24. 5th
ITERATION:
2.for q←4to 7
3.for each character aє(a,b,c)
q=4,a=a
4.k←min(m+1,q+2)=min(8,6)=6
K←6
Pk Pqa=P6 P4a=(ababac ababa)⊐ ⊐ ⊐
FALSE
K←5
Pk Pqa=P5 P4a=(ababa abaBA)⊐ ⊐ ⊐
TRUE
8.δ(q,a)←k
δ(4,a)←5
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 0 b
4 5 a
5 c
6 a
7
25. CONT… k←1
Pk Pqa=P2 P4a=(a ababb)⊐ ⊐ ⊐
FALSE
k←0
Pk Pqa=P2 P4a=(є ababb)⊐ ⊐ ⊐
TRUE
8.δ(q,a)←k
δ(4,b)←0
2.q=4
3.for each character aєb
K←6
Pk Pqa=P6 P4a=(ababac ababb)⊐ ⊐ ⊐
FALSE
K←5
Pk Pqa=P5 P4a=(ababa ababb)⊐ ⊐ ⊐
FALSE
k←4
Pk Pqa=P4 P4a=(abab ababb)⊐ ⊐ ⊐
FALSE
K←3
Pk Pqa=P3 P4a=(aba ababb)⊐ ⊐ ⊐
FALSE
k←2
Pk Pqa=P2 P4a=(ab ababb)⊐ ⊐ ⊐
FALSE
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 0 b
4 5 0 a
5 c
6 a
7
26. CONT…
2.q=4
3.for each character aєc
K←6
Pk Pqa=P6 P4a=(ababac ababc)⊐ ⊐ ⊐
FALSE
K←5
Pk Pqa=P5 P4a=(ababa ababc)⊐ ⊐ ⊐
FALSE
k←4
Pk Pqa=P4 P4a=(abab ababc)⊐ ⊐ ⊐
FALSE
K←3
Pk Pqa=P3 P4a=(aba ababc)⊐ ⊐ ⊐
FALSE
k←2
Pk Pqa=P2 P4a=(ab ababc)⊐ ⊐ ⊐
FALSE
k←1
Pk Pqa=P2 P4a=(a ababbc⊐ ⊐ ⊐
FALSE
k←0
Pk Pqa=P2 P4a=(є ababc)⊐ ⊐ ⊐
TRUE
8.δ(q,a)←k
δ(4,c)←0
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 0 b
4 5 0 0 a
5 c
6 a
7
27. 6th
ITERATION:
k←2
Pk Pqa=P2 P5a=(ab ababaa)⊐ ⊐ ⊐
FALSE
k←1
Pk Pqa=P2 P4a=(a ababbaa⊐ ⊐ ⊐
TRUE
8.δ(q,a)←k
δ(5,a)←1
2.for q←5to 7
3.for each character aє(a,b,c)
q=5,a=a
4.k←min(m+1,q+2)=min(8,7)=7
K←7
Pk Pqa=P7 P5a=(ababaca ababaa)⊐ ⊐ ⊐
FALSE
K←6
Pk Pqa=P6 P5a=(ababac ababaa)⊐ ⊐ ⊐
FALSE
K←5
Pk Pqa=P5 P5a=(ababa ababaa) FALSE⊐ ⊐ ⊐
k←4
Pk Pqa=P4 P5a=(abab ababaa)⊐ ⊐ ⊐
FALSE
K←3
Pk Pqa=P3 P5a=(aba ababaa) FALSE⊐ ⊐ ⊐
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 0 b
4 5 0 0 a
5 1 c
6 a
7
28. CONT…
4.q←5
3.for each character aєb
K←7
Pk Pqa=P7 P5a=(ababaca ababab)⊐ ⊐ ⊐
FALSE
K←6
Pk Pqa=P6 P5a=(ababac ababab)⊐ ⊐ ⊐
FALSE
K←5
Pk Pqa=P5 P5a=(ababa ababab)⊐ ⊐ ⊐
FALSE
k←4
Pk Pqa=P4 P5a=(abab ababab)⊐ ⊐ ⊐
TRUE
8.δ(q,a)←k
δ(5,b)←4
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 0 b
4 5 0 0 a
5 1 4 c
6 a
7
29. CONT…
4.q←5
3.for each character aєc
K←7
Pk Pqa=P7 P5a=(ababaca ababac)⊐ ⊐ ⊐
FALSE
K←6
Pk Pqa=P6 P5a=(ababac ababac)⊐ ⊐ ⊐
TRUE
8.δ(q,a)←k
δ(5,c)←6
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 0 b
4 5 0 0 a
5 1 4 6 c
6 a
7
30. 7TH
ITERATION:
2.for q←6to 7
3.for each character aє(a,b,c)
q=6,a=a
4.k←min(m+1,q+2)=min(8,8)=8
K←8
Pk Pqa=P8 P6a=(ababacaa ababaca)⊐ ⊐ ⊐
FALSE
K←7
Pk Pqa=P7 P6a=(ababaca ababaca)⊐ ⊐ ⊐
TRUE
8.δ(q,a)←k
δ(6,a)←7
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 0 b
4 5 0 0 a
5 1 4 6 c
6 7 a
7
31. CONT… K←1
Pk Pqa=P1 P6a=(a ababacb) FALSE⊐ ⊐ ⊐
K←0
Pk Pqa=P0 P6a=(є ababacb) TRUE⊐ ⊐ ⊐
8.δ(q,a)←k
δ(6,b)←0
2.q←6
3.for each character aєb
K←8
Pk Pqa=P8 P6a=(ababacaa ababacb)⊐ ⊐ ⊐
FALSE
K←7
Pk Pqa=P7 P6a=(ababaca ababacb)⊐ ⊐ ⊐
FALSE
K←6
Pk Pqa=P6 P6a=(ababac ababacb) FALSE⊐ ⊐ ⊐
K←5
Pk Pqa=P5 P6a=(ababa ababacb) FALSE⊐ ⊐ ⊐
K←4
Pk Pqa=P4 P6a=(abab ababacb) FALSE⊐ ⊐ ⊐
K←3
Pk Pqa=P3 P6a=(aba ababacb) FALSE⊐ ⊐ ⊐
K←2
Pk Pqa=P2 P6a=(ab ababacb) FALSE⊐ ⊐ ⊐
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 0 b
4 5 0 0 a
5 1 4 6 c
6 7 0 a
7
32. CONT…
2.q←6
3.for each character aєc
K←8
Pk Pqa=P8 P6a=(ababacaa ababac)⊐ ⊐ ⊐
FALSE
K←7
Pk Pqa=P7 P6a=(ababaca ababac) FALSE⊐ ⊐ ⊐
K←6
Pk Pqa=P6 P6a=(ababac ababac) FALSE⊐ ⊐ ⊐
K←5
Pk Pqa=P5 P6a=(ababa ababac) FALSE⊐ ⊐ ⊐
K←4
Pk Pqa=P4 P6a=(abab ababac) FALSE⊐ ⊐ ⊐
K←3
Pk Pqa=P3 P6a=(aba ababac) FALSE⊐ ⊐ ⊐
K←2
Pk Pqa=P2 P6a=(ab ababac) FALSE⊐ ⊐ ⊐
K←1
Pk Pqa=P1 P6a=(a ababac) FALSE⊐ ⊐ ⊐
K←0
Pk Pqa=P0 P6a=(є ababac) TRUE⊐ ⊐ ⊐
8.δ(q,a)←k
δ(6,c)←0
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 0 b
4 5 0 0 a
5 1 4 6 c
6 7 0 0 a
7
33. 8TH
ITERATION:2.q←7 to 7
3.for each character aє(a,b,c)
q=7,a=a
4.k←min(m+1,q+2)=min(8,9)=8
K←8
Pk Pqa=P8 P7a=(ababacaa ababacaa)⊐ ⊐ ⊐
FALSE
K←7
Pk Pqa=P7 P7a=(ababaca ababacaa) FALSE⊐ ⊐ ⊐
K←6
Pk Pqa=P6 P7a=(ababac ababacaa) FALSE⊐ ⊐ ⊐
K←5
Pk Pqa=P5 P7a=(ababa ababacaa) FALSE⊐ ⊐ ⊐
K←4
Pk Pqa=P4 P7a=(abab ababacaa) FALSE⊐ ⊐ ⊐
K←3
Pk Pqa=P3 P7a=(aba ababacaa) FALSE⊐ ⊐ ⊐
K←2
Pk Pqa=P2 P7a=(ab ababacaa) FALSE⊐ ⊐ ⊐
K←1
Pk Pqa=P1 P7a=(a ababacaa) TRUE⊐ ⊐ ⊐
8.δ(q,a)←k
δ(7,a)←1
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 0 b
4 5 0 0 a
5 1 4 6 c
6 7 0 0 a
7 1
34. CONT… 8.δ(q,a)←k
δ(7,b)←2
2.q←7
3.for each character aєb
K←8
Pk Pqa=P8 P7a=(ababacaa ababacab)⊐ ⊐ ⊐
FALSE
K←7
Pk Pqa=P7 P7a=(ababaca ababacab) FALSE⊐ ⊐ ⊐
K←6
Pk Pqa=P6 P7a=(ababac ababacab) FALSE⊐ ⊐ ⊐
K←5
Pk Pqa=P5 P7a=(ababa ababacab) FALSE⊐ ⊐ ⊐
K←4
Pk Pqa=P4 P7a=(abab ababacab) FALSE⊐ ⊐ ⊐
K←3
Pk Pqa=P3 P7a=(aba ababacab) FALSE⊐ ⊐ ⊐
K←2
Pk Pqa=P2 P7a=(ab ababacab) TRUE⊐ ⊐ ⊐
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 0 b
4 5 0 0 a
5 1 4 6 c
6 7 0 0 a
7 1 2
35. CONT…
K←1
Pk Pqa=P1 P7a=(a ababacac)⊐ ⊐ ⊐
FALSE
K←0
Pk Pqa=P0 P7a=(є ababacac)⊐ ⊐ ⊐
TRUE
8.δ(q,a)←k
δ(7,c)←0
2.q←7
3.for each character aєc
K←8
Pk Pqa=P8 P7a=(ababacaa ababacac)⊐ ⊐ ⊐
FALSE
K←7
Pk Pqa=P7 P7a=(ababaca ababacac)⊐ ⊐ ⊐
FALSE
K←6
Pk Pqa=P6 P7a=(ababac ababacac) FALSE⊐ ⊐ ⊐
K←5
Pk Pqa=P5 P7a=(ababa ababacac) FALSE⊐ ⊐ ⊐
K←4
Pk Pqa=P4 P7a=(abab ababacac) FALSE⊐ ⊐ ⊐
K←3
Pk Pqa=P3 P7a=(aba ababacac) FALSE⊐ ⊐ ⊐
K←2
Pk Pqa=P2 P7a=(ab ababacac) FALSE⊐ ⊐ ⊐
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 0 b
4 5 0 0 a
5 1 4 6 c
6 7 0 0 a
7 1 2 0
36. REQUIRED
RESULT:
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 0 b
4 5 0 0 a
5 1 4 6 c
6 7 0 0 a
7 1 2 0
THE FINITE STATE
AUTOMATA IS:
0 1 2 3 4 5 6 7
a b a b a c a
a
a
b
b
a
a
53. CONT..
State a b c P
0 1 0 0 a
1 1 2 0 b
2 3 0 0 a
3 1 4 0 b
4 5 0 0 a
5 1 4 6 c
6 7 0 0 a
7 1 2 0
i= - 1 2 3 4 5 6 7 8 9 10
11
T[i] - a b a b a b a c a b a
state ΦT[i] 0 1 2 3 4 5 4 5 6 77 2 3
55. COMPLEXITY
ANALYSIS:
• The simple loop time of FINITE-AUTOMATON-MATCHER implies that
its matching time on the text string of length is Θ(n).This matching
time does not include the preprocessing time required to compute
the transition function δ)
• The running time of COMPUTE-TRANSITION-FUNCTION is
O(m^3 ∑ ),because the outer loops contribute a factor of│ │
m ∑ ,the inner repeat loop can run atmost m+1 times, and the test│ │
Pk Pqa on line 7 can require computing upto m characters.⊐
• Much faster procedures exist; the time required to compute δ from
P can be improved to O(m ∑ ) by utilizing some cleverly computed│ │
information about the pattern P. With this improved procedure for
computing δ from P to O(m| |), we can find all occurrences of aƩ
length-m pattern in a length-n text over an alphabet ∑ with
O(m ∑ ) preprocessing time and Θ(n) matching time.│ │
57. ADVANTAGES &
DISADVANTAGE:
• String matching automaton are very efficient
• Examine each text character exactly once taking
constant time per text character.
• The time to build the automaton can be large if Ʃ
is large