|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
79 srand((
unsigned int)time(
nullptr));
96 if (cur[h] && *(cur[h]->entry) < *item) {
99 return cur[0] && *(cur[0]->
entry) == *item;
117 if (cur[h] && *(cur[h]->entry) < *item) {
146 item = item->
next[0];
171 while (rand() > RAND_MAX / 2) {
182 if (newStart ==
nullptr) {
188 for (
int i = newheight; i-- >
m_height;) {
197 class SkiplistIterator {
The namespace for all OGDF objects.
Element(const X &item, int height)
void add(X item)
Adds the item item into the skiplist [O'(log n)].
bool empty() const
Returns true if the skiplist contains no elements.
bool isElement(X item) const
Returns true if the item item is contained in the skiplist [O'(log n)].
SkiplistIterator(const typename Skiplist< X >::Element *e)
SkiplistIterator< X > & operator++()
Move the iterator one item forward (prefix notation)
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
void clear(bool killData=false)
Clears the current skiplist.
const X & operator*() const
Returns the item to which the iterator points.
const SkiplistIterator< X > end() const
returns an invalid iterator
Skiplist()
Construct an initially empty skiplist.
const SkiplistIterator< X > begin() const
returns an (forward) iterator for the skiplist
SkiplistIterator< X > operator++(int)
Move the iterator one item forward (prefix notation)
bool operator!=(const SkiplistIterator< X > other) const
int size() const
Returns the current size of the skiplist, i.e., the number of elements.
bool operator==(const SkiplistIterator< X > other) const
Forward-Iterator for Skiplists.
Declaration of memory manager for allocating small pieces of memory.
const Skiplist< X >::Element * el
Internal structure to hold the items and internal forward pointers of the skiplist.