SkipList Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

describe the insert method of the skiplist in pseudo code

A
p= skipsearch(k)
q = insertafterabove(p, null, (k,v))
e = q.element()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

describe in words the insertion of a skiplist

A

insert(x,o)

  1. using a randomized algorithm
  2. repeatedly toss a coin until we get a tail, using I to denote the number of time heads was obtained
  3. if I >= h, add on to the skiplists until h = i+1
  4. search for the key x and keep track of the position containing largest key less than x in each list going up till Si
  5. for j = 0,1,2,3, …,i insert (x,o) into S till Sj after pj
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

describe in words the removal method

A

to remove an entry x

  1. search for x in the list an find positions p1, …, pj
  2. Where position pj is in the list
  3. remove p0, …, pi in list S0, …, Si
  4. remove all list but one containing the 2 special keys
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

describe the quad node

A

type of node storing:
element, above, below, prev and next

used to implement a skip list

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

What is the probability of getting i consecutive heads when flipping a coin?

A

1/2^i

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

Probable size of a skiplist?

A

n/2^i

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

expected space usage for a skiplist?

A

O(n)

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

What is the height of a skiplist?

A

O(log n)

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

search, insertion, and deletion runtime?

A

O(log n)

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