Пример #1
0
        public SkipListEntry InsertAfterInLinkedList(string key, int?value, SkipListEntry skipListEntry)
        {
            var newSkipListEntry = new SkipListEntry(key, value);

            newSkipListEntry.Right   = skipListEntry.Right;
            skipListEntry.Right.Left = newSkipListEntry;
            skipListEntry.Right      = newSkipListEntry;
            newSkipListEntry.Left    = skipListEntry;
            return(newSkipListEntry);
        }
Пример #2
0
        private void CreateNewLevel()
        {
            var newHead = new SkipListEntry(SkipListEntry.negInf, null);
            var newTail = new SkipListEntry(SkipListEntry.posInf, null);

            newHead.Right = newTail;
            newTail.Left  = newHead;
            newHead.Down  = _head;
            if (_head != null)
            {
                _head.Up = newHead;
            }

            newTail.Down = _tail;

            if (_tail != null)
            {
                _tail.Up = newTail;
            }

            _head = newHead;
            _tail = newTail;
        }