public void doSanityCheck() { int count = 0; double prevKey = Double.MIN_VALUE; Node n = safeNext(head); while (n != null) { count++; if (!skipListMap.containsKey(n.first())) { System.out.println("Node n not in skiplistMap:" + n.first()); n._print(); } if (n.first() < prevKey) { System.out.println("Error in ordering, prevKey:" + prevKey + ", n:" + n); } prevKey = n.first(); Node next = safeNext(n); release(n); n = next; } if (skipListMap.size() != count) { System.out.println("skipListMap.size:" + skipListMap.size() + ", count:" + count); } }
public void _print() { for (Node n = head; n != null; n = n.next) { n._print(); } }