Question
The lecture on Rabin-Karp string matching covered both the actual Java hash function and a strawman hash function, where the hash value of a string is just the sum of the character values in the string. Assume that we modified the Rabin-Karp string matching algorithm to use the strawman hash instead of the Java hash. (
View Answer
Try AI Generated Solution
Answer

The lecture on Rabin-Karp string matching covered both the actual Java hash function and a strawman hash function, where the hash value of a string is just the sum of the character values in the string. Assume that we modified the Rabin-Karp string matching algorithm to use the strawman hash instead of the Java hash. (That is, we change the mathematical expressions in the 'update' loop, and change the initial computations of texthash and patternhash before the loop, but do not modifying any other part of the code.) What would be the effect of this change? Select one: O a. It should work exactly as well O b. It should have the same running speed, but it would no longer be guaranteed to be a correct pattern matching algorithm O c. It would still be a correct pattern matching algorithm, but it could be much slower on some data. O d. Both problems could arise (worse running time and an incorrect algorithm)

Get solved by expert tutor

Not the answer you're looking for? Let our experts create a unique solution for you

Found 10 similar results for your question:

3. We have a two-word query. For one term the postings list consists of the following 16 entries: [4,6,10,12,14,16,18,20,22,32,47,81,120,122,157,180] and for the other it is the one entry postings list: [47]. Work out how many comparisons would be done to intersect the two postings lists with the following two strategies. Briefly justify your answers (Let (x,y) denote a posting comparison. x refers to a value in the upper list and y refers to a value in the lower list) write down those comparisons): a. Using standard postings lists b. Using postings lists stored with skip pointers, with a skip length of VP (for a postings list of length P).

Draw the binary tree representation of the following arithmetic expression (((5+2) * (2-1)) / ((2+9) + ((7−2) − 1)) * 8) Write this expression to its postfix equivalent.

2. An algorithm takes 0.5 ms for input size 100. How long will it take for input size 500 if the running time is the following (assume low order terms are negligible) a. Linear b. O(NlogN) c. Quadratic

5. Consider the following fragment of a positional index with the format: word: document: (position, position, ...); document: (position, ...) Gates: 1: (3); 2: (6); 3: (2,17); 4: (1) IBM: 4: (3); 7: (14) Microsoft: 1: (1); 2: (1,21); 3: (3); 5: (16,22,51) The /k operator, word1 /k word2 finds occurrences of word1 within k words of word2 (on either side), where kis a positive integer argument. Thus k=1 demands that word1 be adjacent to word2. a. Describe the set of documents that satisfy the query Gates /2 Microsoft. b. Describe each set of values for k for which the query Gates /k Microsoft returns a different set of documents as the answer.

(a) Suppose you work for a major airline and are given the job of writing the algorithm for processing upgrades into first class on various flights. Any frequent flyer can request an upgrade for his or her up-coming flight using this online system. Frequent flyers have different priorities, which are determined first by frequent flyer status (which can be, in order, silver, gold, platinum, and super) and then, if there are ties, by length of time in the waiting list. In addition, at any time prior to the flight, a frequent flyer can cancel his or her upgrade request (for instance, if he or she wants to take a different flight), using a confirmation code they got when he or she made his or her upgrade request. When it is time to determine upgrades for a flight that is about to depart, the gate agents inform the system of the number, k, of seats available in first class, and it needs to match those seats with the k highest-priority passengers on the waiting list. Describe a system that can process upgrade requests and cancellations in O(log n) time and can determine the highest-priority flyers on the waiting list in O(k log n) time, where n is the number of frequent flyers on the waiting list.

1. The following pairs of words are stemmed to the same form by the Porter stemmer. Which pairs would you argue shouldn't be conflated. Give your reasoning. a. abandon/abandonment b. absorbency/absorbent c. marketing/markets d. university/universe e. volume/volumes

Which of the below is the correct way to call the function " ": A. cout<<myFunction(10 , 12.45); O B. myFunction (7, 4); O C. myFunction(12.5, 11.8); D. cout<<myFunction(10.7, 6);

Northeastern University CET2200 – Data Structures and Algorithms Homework 4 1. Order the following functions by growth rate N, N1.5, N2, √N, NlogN, 2N.

What is the output of the following piece of code? #include <iostream> using namespace std; int main() { int array [] = {1, 2, 3, 4, 5); cout<<array[4]; return 0; }

4. Assume a biword index. Give an example of a document which will be returned for a query of New York University but is actually a false positive which should not be returned.