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 :
.