When a mismatch occurs in the KMP algorithm at text position i and pattern position j,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
When a mismatch occurs in the KMP algorithm at text position i and pattern position j, neither the mismatched text character T[i] nor pattern character P[j] are considered when shifting the pattern. In this question, you will modify KMP to make use of P[j] and T[i] when shifting the pattern. You must not alter the fundamental principles of the KMP algorithm; i.e. when the pattern is shifted, the prefix of the pattern that matches with the text T[k] for ki must not be rechecked. a) Describe how to modify the KMP failure array and/or algorithm to make use of P[j]. State and briefly explain the runtime of the modified pre-processing step and algorithm if they are different from KMP. b) Describe how to modify the KMP failure array and/or algorithm to make use of T[i]. State and briefly explain the runtime of the modified pre-processing step and algorithm if they are different from KMP. Consider the following two cases separately. i) T[i] is not a character that occurs in the pattern. ii) T[i] is a character that occurs in the pattern; i.e. when the pattern is shifted, the prefix of the pattern that matches the text T[k] for k i must not be rechecked.ad When a mismatch occurs in the KMP algorithm at text position i and pattern position j, neither the mismatched text character T[i] nor pattern character P[j] are considered when shifting the pattern. In this question, you will modify KMP to make use of P[j] and T[i] when shifting the pattern. You must not alter the fundamental principles of the KMP algorithm; i.e. when the pattern is shifted, the prefix of the pattern that matches with the text T[k] for ki must not be rechecked. a) Describe how to modify the KMP failure array and/or algorithm to make use of P[j]. State and briefly explain the runtime of the modified pre-processing step and algorithm if they are different from KMP. b) Describe how to modify the KMP failure array and/or algorithm to make use of T[i]. State and briefly explain the runtime of the modified pre-processing step and algorithm if they are different from KMP. Consider the following two cases separately. i) T[i] is not a character that occurs in the pattern. ii) T[i] is a character that occurs in the pattern; i.e. when the pattern is shifted, the prefix of the pattern that matches the text T[k] for k i must not be rechecked.ad
Expert Answer:
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date:
Students also viewed these programming questions
-
Briefly describe ASCII and Unicode and draw attention to any relationship between them. [3 marks] (b) Briefly explain what a Reader is in the context of reading characters from data. [3 marks] A...
-
Portray in words what transforms you would have to make to your execution to some degree (a) to accomplish this and remark on the benefits and detriments of this thought.You are approached to compose...
-
Let y vary directly with x. Complete the following. Find y when x = 1, if y = when x = 3.
-
The loss, in millions of dollars, due to a fire in a commercial building is a variable with density curve y = 1 x/2 for 0 < x < 2, and y = 0 otherwise. Using the fact that the area of a triangle...
-
Show that the set K = { 3 t 2 + 2 t + 1 , t 2 + t + 1 , t 2 + 1 } spans P 2 . ( b ) Is K from part ( a ) a basis for P 2 ? Explain.
-
The velocity of a fluid particle moving along a horizontal streamline that coincides with the \(x\) axis in a plane, two-dimensional, incompressible flow field was experimentally found to be...
-
In Orthogonal Design for Process Optimization and Its Application to Plasma Etching (Solid State Technology, May 1987), G. Z. Yin and D. W. Jillie describe an experiment to determine the effect of...
-
Describe how organizations, utilize approaches and methods that drive forward the design of the employee experience, improve productivity, and enable high-performing talent practices to be...
-
Jordan and Julianne Marra both work. Julianne is a part-time environmental lawyer whose W-2 provided the following information. Wages, tips, other compensation: $51,122.00 Social Security wages:...
-
1. [10 points] Suppose we could deploy a mechanism that would ensure IP source addresses always corresponded to the actual sender of a packet. In other words, it is impossible for an attacker to...
-
Assuming the absolute path referenced in the code exists and its contents are accessible, which statement about the following code snippet is correct? A. The first stream statement does not compile....
-
Which of the following methods is not available on an ExecutorService instance? (Choose two.) A. execute(Callable) B. shutdownNow() C. submit(Runnable) D. exit() E. submit(Callable) F....
-
Assuming the file referenced in the StudentManager class exists and contains data, which statement about the following class is correct? (Choose two.) A. The code does not compile. B. The code...
-
Assuming the file path referenced in the following class is accessible and writable, what is the output of the following program? (Choose two.) A. 1 B. 23 C. 13 D. The code does not compile. E. If...
-
Which two method names, when filled into the print2() method, produce the same output as the print1() method? Assume the input arguments for each represent the same non-null numeric value. A....
-
Clarence is a new audit junior and is attending training sessions at the audit firm. Clarence is trying to focus on the main points in the training because there will be a test at the end of the...
-
Use the following data to answer the next two (2) questions: Product 1 Product 2 Product 3 Direct Material Cost $25,000 $30,000 $35,000 Direct Labor Cost $30,000 $40,000 $50,000 Direct Labor Hours...
-
Show that in an undirected graph, classifying an edge (u, ) as a tree edge or a back edge according to whether (u, ) or (, u) is encountered first during the depth-first search is equivalent to...
-
Professor Williams comes up with a scheme that allows the closest-pair algorithm to check only 5 points following each point in array Y. The idea is always to place points on line l into set P L ....
-
Show that for any integer n ? 0, n k = n2"-1 k=0
-
Why is the definition of quality critical to the success and acceptance of a project?
-
What would the QA/QC planning grid (see Figure 12. 6) look like for a project you have been involved in? Data from Figure 12. 6 Table 12.6 QA/QC planning grid, with examples Quality assurance...
-
What quality systems and standards exist in your organisation to 1) ensure quality across the project and 2) ensure quality within the products and services produced by your projects?
Study smarter with the SolutionInn App