1 answer

3b) [4 pts]+ As in the Little SearchEngine assignment, consider a hash table that stores frequencies...

Question:

3b) [4 pts]+ As in the Little SearchEngine assignment, consider a hash table that stores frequencies (number of occurrences)

3b) [4 pts]+ As in the Little SearchEngine assignment, consider a hash table that stores frequencies (number of occurrences) of words in a set of documents. Words are the keys, and for each word, the associated value is an array list of (document name, frequency) pairs, in descending order of frequencies. Now suppose you are given a list of 50 words. You are asked to find all documents in the hash table in which one or more of these words each occurs with a frequency of f or more (f is an integer parameter). The final result should be a list of documents without duplicates. (In other words, if word1 occurs with a frequency >= f in doc1, and word2 also occurs with a frequency >= f in doc1, then doc1 should only be reported once in the final result.) This non-duplication can be achieved by storing the resulting document names in a hash set. Describe an algorithm for how you would do this (no Java code, write steps in plain English). Your algorithm should not look at more documents in the hash table than is absolutely necessary to find those with frequencies >= f for the given words." 3c) [4 pts] This part pertains to the algorithm you came up with in Q3b above. Assuming that a total of n document names appear in the hash table, and there are k document matches (duplicates included, of which u are unique) over all the 50 words combined, derive the big O running time of your algorithm. For each big O component of the running time, specify whether it is worst case or expected case. You don't have to add up the components to a single big 0. Show your work - just big O answers without derivation will get no credit. Also, your big O derivation will not get credit if your algorithm in 3b) is incorrect.

Answers

Ans for Qn 3b):

Let, the set of words we have W = (w1,w2,.....,w50) for which we have to find the document names.

We have the hash table that stores the frequencies of each individual word in a set of documents, where each entry in the hash table contains the pair of (word frequency, document name) pair.

We have to find the document list for all the words given in the set.

Step 1: Take an empty hash set(set size = number of documents) where the key is the document name.

Step 2: For each word in the given word set (50 words), steps 3 to 5 will be executed.

Step 3: Search for that particular word in the given hash table.

Step 4: If the occurance of that word >=f, then remember all the corresponding document name(s) present in the array list associated with that word in the given hash table. (Suppose if any word is present in two documents but it is present for >=f times only in one document, then consider that document only from the list.)

Step 5: Try to insert all the document name(s) in the new hash set. If the particular position is not empty (i.e. if that specific document name is already present in the hash set, then that entry is full and the document name can't be inserted twice), then skip the document name, otherwise enter the name into the hash set accordingly.

Step 6: Iteration for the 50 words ends here.

Step 7: The required result will be stored in the newly created hash set.

Step :

.

Similar Solved Questions

1 answer
The question asking what kind of actions or programs we can implement to make sure the...
The question asking what kind of actions or programs we can implement to make sure the orgnization can get the maximum benefits of the patentable ideas. Thanks 2. As an R&D manager, what actions might you take or programs might you implement to assure your organization got maximum benefit fro...
1 answer
PLEASE USE FOUR FORCES IN TERMS OF F (FRICTION) N(NORMAL REACTION) T(TENSION IN THE ROPE) AND W(W...
PLEASE USE FOUR FORCES IN TERMS OF F (FRICTION) N(NORMAL REACTION) T(TENSION IN THE ROPE) AND W(WEIGHT) Question 6 20 marks You should be able to answer this question after studying Unit 5 A mountain rescue team is preparing to move a stretcher (with an injured climber) down a flat slope. The combin...
1 answer
Problem 2: Consider the circuit shown in Figure 2. VCC-15V, R1-100 K2, R2-47 K2, RE-3.9K, Draw the small signal model Compute rel and re2. Rin1 and Rin2 as (shown in the circuit) . Find the overall g...
Problem 2: Consider the circuit shown in Figure 2. VCC-15V, R1-100 K2, R2-47 K2, RE-3.9K, Draw the small signal model Compute rel and re2. Rin1 and Rin2 as (shown in the circuit) . Find the overall gain. Using OCTC approach compute the high frequency time constants, given Cr-Cμ-1 pF. Stage 2 Load...
1 answer
1. Draw a free body diagram for the two situations below:
1. Draw a free body diagram for the two situations below:...
1 answer
Need help with python and raptor codes:
Design a program that calculates and displays the number of miles per hour over the speed limit that a speeding driver was doing. The program should ask for the speedlimit and the driver's speed. Validate the input as follows:-The speed limit should be at lease 20, but not greater than 70.-The d...
1 answer
When writing open contrary you Wed filled sublevels end is then. sequoia. you can Lester editor...
When writing open contrary you Wed filled sublevels end is then. sequoia. you can Lester editor tq t0 to- to toe P-tote and the the lest which be lied, to each to drag the items to their appropriate bins....
1 answer
QUESTION 40 A larpe curved Dam is created by rotating the triangle shape BCD through an...
QUESTION 40 A larpe curved Dam is created by rotating the triangle shape BCD through an angle of 60"radions) about vertical axis -9. The drawing is not to scale. -1035ft- 100ft dB 35 1 000ft Determine the Surface Area of the Dam's downstream face (created by the revolution of line DB). 105 (...
1 answer
Why does a solution of a weak base and its conjugate acid act as a better...
Why does a solution of a weak base and its conjugate acid act as a better buffer than does a solution of the weak base alone...
1 answer
Please label parts of questions CLEARLY as well as answering all parts in full. (40 Marks) Problem #3 Desert air at 38°...
Please label parts of questions CLEARLY as well as answering all parts in full. (40 Marks) Problem #3 Desert air at 38°C, bar, and 26% relative humidity is passed through an evaporative cooler. Water is added at 36°C, and the final air temperature exiting the cooler is 24°C. Determine: a...
1 answer
A customer service representative must spend different amounts of time with each customer to resolve various...
A customer service representative must spend different amounts of time with each customer to resolve various concerns. The amount of time spent with each customer can be modeled by the following distribution: X ~ Exp(0.7) Find μ. Round to nearest tenths. a. 4.2 b.2 c.1.4 d. 2.1...
1 answer
Why is the estimation of property level cash inflows and outflows often just the first step...
Why is the estimation of property level cash inflows and outflows often just the first step in determining the cash flows and returns expected by various investors in the ownership entity?...
1 answer
WILL RATE FAST: P14.8B (LO 3) (Entries for Zero-Interest-Bearing Note) On December 31, 2020, Payson Company...
WILL RATE FAST: P14.8B (LO 3) (Entries for Zero-Interest-Bearing Note) On December 31, 2020, Payson Company acquired a press from Sugar Corporation by issuing a $400,000 zero-interest-bearing note, payable in full on December 31, 2023. Payson's credit rating permits it to borrow funds from its s...
1 answer
Part B please Revi A charge of -2.795 C is located at (2.970 m. 4.786 m...
Part B please Revi A charge of -2.795 C is located at (2.970 m. 4.786 m ), and a charge of 1.555 C is located at (-2.644 m.) Express your answer using three significant figur V = 826 V Correct Part B There is one point on the line connecting these two charges where the potential is zero. Find this p...
1 answer
Child Tax Credit $2,000 Federal Income Tax Withheld: $2,182 IRA Deduction: $1,500 Itemized Deduction: $6,250 Personal...
Child Tax Credit $2,000 Federal Income Tax Withheld: $2,182 IRA Deduction: $1,500 Itemized Deduction: $6,250 Personal Exemption: 6,600 Tax from tax schedule: $3.642 Taxable Interest: $238 98) Wages: $50,000 Calculate taxable income. A) $50,238 B) $35,888 C) $33,888 D) $48,738...
1 answer
This is for dental hygiene pls help this for dental hygiene its, not for nursing Discuss one of type of x-ray radiation...
this is for dental hygiene pls help this for dental hygiene its, not for nursing Discuss one of type of x-ray radiation. Tell us about x-rays you have had and how you were protected from scatter radiation....
1 answer
With the steps of the solution 8) The () centroid for the shaded area shown in...
with the steps of the solution 8) The () centroid for the shaded area shown in the figure is A) 900 cm B) 40.0 cm C) 34.7 cm D) 29.2 cm Neerd Al Huson Two couples acts on the plate. Determine the magnitude of F so that the resultant couple moment is 120 Nm, counterclockwise -F A) 90N B) 8o N C) 120N...