Random data structures Flashcards

1
Q

Skip lists (idea)

A

Have a number of linked lists, reducing search operation times. The top most level will have just two nodes and will gradually be more until you reach the lowest level with all the nodes. Each node will be put in a higher level with a 0.5 probability.

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

Skip lists put method

A

Add the key to the correct spot in the lowest level. Then each Time put it also in the upper level with a 0.5 probability. Do this until you randomly pick to not put it in then higher level or you add a new level.

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

Skip lists (size and time)

A

On average each key will be in two lists, meaning that the size is 2n = O(n). Height O(logn). Time for all operations O(logn)

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

Bloom filter (idea)

A

Initialize an array to be all zeroes. Each time you insert a new key, pass it through k different hash functions each give you an index. increment the value of the array at them indices by one. know for sure if a key is not in the filter but not the opposite.

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

Bloom filter (mistake rate)

A

𝜀=(1−(1−1/𝑚)^𝑘𝑛 )^𝑘≈(1−𝑒^((−𝑘𝑛)/𝑚) )^𝑘 .
m - size of array
k - number of hash functions
n - number of inserted elements

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

Bloom filter (best results n,k,m)

A

For best results: larger array (higher m), lower inserted elements (lower n). Number of hash functions has mixed effect.

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