From c3ce00a82dc987fb48a85d676aa3d6e9ce2a7513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Sun, 8 Apr 2012 21:21:52 +0200 Subject: [PATCH] added a comment on skiplist.js --- src/static/js/skiplist.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/static/js/skiplist.js b/src/static/js/skiplist.js index 58477acc..a02a2ad5 100644 --- a/src/static/js/skiplist.js +++ b/src/static/js/skiplist.js @@ -155,6 +155,9 @@ function SkipList() var widthLoc = point.widthSkips[0] + point.nodes[0].downSkipWidths[0]; var newWidth = _entryWidth(entry); p.mark("loop1"); + + // The new node will have at least level 1 + // With a proability of 0.01^(n-1) the nodes level will be >= n while (newNode.levels == 0 || Math.random() < 0.01) { var lvl = newNode.levels;