Questions Chapter 11 Flashcards

1
Q

Using big O notation, how long does it take (ideally) to find an item in a hash table

A

O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A ______ ______ transforms a range of key values into a range of index values

A

hash function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Using the next available position after an unsuccessful probe is called:

A

linear probing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the first five step sizes in quadratic probing?

A

x+1^2, x+2^2, x+3^2, x+4^2, x+5^2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Secondary clustering occurs because:

a. many keys hast to the same location
b. the sequence of step lengths is always the same
c. too many items with the same key are inserted
d. the hash function is not perfect

A

b. the sequence of step lengths is always the same

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Separate chaining involves a _________ at each location in the hash table.

A

linked list at each location in the hash table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A reasonable load factor in separate chaining is:

A

1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

True or False: A possible hash function for strings involves multiplying each character by an ever-increasing power

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The best technique when the amount of data is not well-known is:

a. linear probing
b. quadratic probing
c. double hashing
d. separate chaining

A

d. separate chaining

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

If digit folding is used in a hash function, the number of digits in each group should reflect:

A

the size of the array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

True or False: In linear probing, an unsuccessful search takes longer than a successful search

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

In separate chaining, the time to insert a new item

a. increases linearly with the load factor
b. is proportional to the number of items in the table
c. is proportional to the number of lists
d. is proportional to the percentage of full cells in the array

A

a. increases linearly with the load factor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

True or False: In external hashing, it’s important that the blocks don’t become full.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In external hashing, all records with keys that hash to the same value are located in _________________

A

the same block

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The hashing of a key to an already filled array-cell is called:

A

a collision

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

collisions can be handled in two major ways:

A

open addressing and separate chaining

17
Q

Three kinds of open addressing for hash tables:

A

linear probing, quadratic probing, double hashing

18
Q

In linear probing, the step size is always __, so if x is the array index calculated by the hash function, the probe goes to _____

A

x, x+1, x+2…

19
Q

In linear probing, contiguous sequences of filled cells appear. They are called _______ ________ and reduce performance

A

primary clusters

20
Q

In quadratic probing, the offset from x is the square of the step number, so the probe goes to x, ____, ____, ____…

A

x+1, x+4, x+9

21
Q

If the secondary hash function returns a value of s in double hashing, the probe goes to x, ____, ____, ____…

A

x+s, x+2s, x+3s

22
Q

The load factor of a hash table is:

A

the ratio of data items to array size