227
4.8
Creating a multiplication table with all the elements in the array.
So if your array is [2, 3, 7, 8, 10], you first multiply every element
by 2, then multiply every element by 3, then by 7, and so on.
Answer:
O(
n
2
)
CHAPTER 5
Which of these hash functions are consistent?
5.1
f(x) = 1
Returns “1” for all input
Answer:
Consistent
5.2
f(x) = rand()
Returns a random number every time
Answer:
Not consistent
5.3
f(x) = next_empty_slot()
Returns the index of the next
empty slot in the hash table
Answer:
Not consistent
5.4
f(x) = len(x)
Dostları ilə paylaş: