Skip Lists Done Right
11–20 of 87 posts
Re: Skip Lists Done Right
#12Re: Skip Lists Done Right
#13There are a few reasons:
1) They are not very memory intensive. It's up to you basically. Changing parameters about the probability of a node to have a given number of levels will make then less memory intensive than btrees.
2) A sorted set is often target of many ZRANGE or ZREVRANGE operations, that is, traversing the skip list as a linked list. With this operation the cache locality of skip lists is at least as good as with other kind of balanced trees.
3) They are simpler to implement, debug, and so forth. For instance thanks to the skip list simplicity I received a patch (already in Redis master) with augmented skip lists implementing ZRANK in O(log(N)). It required little changes to the code.
Re: Skip Lists Done Right
#14http://leandro.me/MyDataStructures/#/data-structures/skip-li...
Tip: click "Insert a random item" a bunch of times to populate the (initially empty) skip list.
Re: Skip Lists Done Right
#15Excellent article, I really love algorithm and datastructure. if anyone else is interested like me, I recommend this book https://www.amazon.com/Introduction-Algorithms-3rd-MIT-Press...
It is also very handy if you need to flatten a small (< 2 kg) household pet.
Re: Skip Lists Done Right
#16> I can't seem to find my favorite trick: deterministic (ie. without rng) skipping by linking on traversal instead of insert/delete. Says one comment. Can anyone explain that?
Re: Skip Lists Done Right
#17Looks like I already do pretty much all those things in twoskip: https://blog.fastmail.com/2016/12/03/cyrus-databases-twoskip... (except for the level choice. Which is a bit meh to me, because a write will probably trigger 3 fsyncs, so the cost of level choice is very low) That said, my next DB won't have any skiplists in it I don't think, or at most an in-memory one, but not on disk.
>That said, my next DB won't have any skiplists in it I don't think, or at most an in-memory one, but not on disk. What will you use instead (and why)?
I think his claim that his optimizations can beat a b-tree is bullshit otherwise he would've shown benchmarks.
Re: Skip Lists Done Right
#18Recently I got rid of huge bottleneck on an oldish piece of software by moving from a vanilla linked list to a skip list. And I did do many things suggested in the article (e.g. having a vector of fixed length for the pointers, and thus a fixed tallness).
Funnily enough, for my case, I managed to do without a RNG just fine. I just have an element that is of tallness 'k' every 2^(k*3) insertions (e.g. every 8th insertion is 1 level tall; every 64th insertion is 2 levels tall; and so on). For my particular pattern of insertions, this proved to be more than enough, and and simplified things a little bit.
Re: Skip Lists Done Right
#19> I can't seem to find my favorite trick: deterministic (ie. without rng) skipping by linking on traversal instead of insert/delete. Says one comment. Can anyone explain that?
Doesn't seem like much of a trick, though. If you can do that, then you can just stick it all in an array and bsearch to find things.