public class SkipList<T extends Comparable<T>> extends Object implements Iterable<T>
A skip list is a linked list with additonal links that skip over N elements in the list. This permits linear searches of the list to skip N nodes when looking for the desired node. Once the section of the list containing the desired node is located a linear search of those N nodes is performed.
Note: only every Nth node contains the "skip link".
| Modifier and Type | Class and Description |
|---|---|
class |
SkipList.SkipNode<T1> |
| Constructor and Description |
|---|
SkipList() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(T item) |
protected void |
addToBlock(SkipList.SkipNode<T> block,
T item) |
void |
clear() |
void |
delete(SkipList.SkipNode<T> node) |
SkipList.SkipNode<T> |
find(T item) |
protected SkipList.SkipNode<T> |
findBlock(T item)
Return the late node such that the item stored at that node is <= the item
we are looking for.
|
T |
get(T item) |
Iterator<T> |
iterator() |
static void |
main(String[] args) |
void |
print() |
void |
remove(T item) |
void |
replace(T item) |
long |
size() |
protected void |
split(SkipList.SkipNode<T> block) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic long size()
public void clear()
public void add(T item)
public void replace(T item)
public SkipList.SkipNode<T> find(T item)
public void remove(T item)
public void delete(SkipList.SkipNode<T> node)
public Iterator<T> iterator()
iterator in interface Iterable<T extends Comparable<T>>protected SkipList.SkipNode<T> findBlock(T item)
item - T The item being searched for.protected void addToBlock(SkipList.SkipNode<T> block, T item)
protected void split(SkipList.SkipNode<T> block)
public void print()
public static void main(String[] args)
Copyright © 2016 The American National Corpus. All rights reserved.