Question

If you have an ideal skip list of 1000 items, how many levels would you have...

If you have an ideal skip list of 1000 items, how many levels would you have and how many items would be on each level? Explain why/how you decided on those numbers/levels. Why would that be ideal?

C++ Data Structures

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Skip list are randomized data structures having expected search time of log(n) compared to linked list with O(N) search complexity.

What if there are two sorted linked list? Search cost would reduce to O(N1/2).

For three it is O(N1/3). and so on..

So if there are log(n) skip lists it would have complexity of Log(n). This is ideal skip list with Log(n) levels.

Element are inserted randomly in skip lists to upper levels by flipping coin. So base level has n elements next level has n/2 element and so on.

So level 0 =1000 elements

level 1=500

level 2=250

level 3=125

level 4=63

level 5=32

level 6=16

level 7=8

level 8=4

level 9=2

level 10 = 1

So it has 10 levels with no. of elements as shown above.

Alternatively no. of levels are equal to logn. In this case log(1000) = 10 (rounded to next integer).

Add a comment
Know the answer?
Add Answer to:
If you have an ideal skip list of 1000 items, how many levels would you have...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT