MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In a Hash Table, what ideally should the size of the table be?
A
same size as the amount of data to hold
B
an odd number
C
an even number
D
a prime number
Explanation: 

Detailed explanation-1: -But a good general “rule of thumb” is: The hash table should be an array with length about 1.3 times the maximum number of keys that will actually be in the table, and. Size of hash table array should be a prime number.

Detailed explanation-2: -Using primes for hash tables is a good idea because it minimizes clustering in the hashed table.

Detailed explanation-3: -The hashing functions return a 128-bit, 160-bit, 256-bit, or 512-bit hash of the input data, depending on the algorithm selected. An expression that represents the string value to be hashed.

Detailed explanation-4: -The size of a hash table should always be an odd number. 14. Using a hash table size that is a prime number distributes values through the index range better than if the size is an even number.

Detailed explanation-5: -Double hashing requires that the size of the hash table is a prime number. Using a prime number as the array size makes it impossible for any number to divide it evenly, so the probe sequence will eventually check every cell.

There is 1 question to complete.