1,086 views
0 votes
0 votes

A program that checks spelling works in the following way.

  • A hash table has been defined in which each entry is a Boolean variable initialized to false.
  • A hash function has been applied to each word in the dictionary, and the appropriate entry in the hash table has been set to true.
  • To check the spelling in a document, the hash function is applied to every word in the document, and the appropriate entry in the hash table is examined.

Which of the following is (are) correct?

I. true means the word was in the dictionary.

II. false means the word was not in the dictionary.

III. Hash table size should increase with document size.

(A) I only

(B) II only

(C) I and II only

(D) II and III only

1 Answer

0 votes
0 votes

answer is (C) with assumption...that every appropriate word of document is always present in hash table..

for every word in the dictionary....is placed in one slot of hash table

let boolean var = X

a   X=T
aa  X=F
ab  X= F
...  
an  X= T
...  
ang  X = F
...  
....  
anger  X = T

so the words  that are true are available in dictionary..

false surely means the word is not there in dictionary..

increase in the document size doesn't effect the hash table size...as it already has  entry for every word arrangement possible...

edited by

Related questions

0 votes
0 votes
1 answer
1
tishhaagrawal asked Dec 16, 2023
361 views
Below is my approach to solving this question, can anyone please explain if I am doing it the right way?Let X = #free slotssince, m =7 and n = 3So, $4 \leqslant x\leqsla...