A KeyedSSkipList
is a Sorted Associative Container that associates objects of type K
, the key, with objects of type T
, the data.
It is a Pair Associative Container, meaning that its value type is pair<const K, T>
.
It is a Unique Sorted Associative Container, meaning that no two elements have the same key.
It is a Associative Container LOGN, meaning that erasing of a single element is logarithmic.
It is a Destructive Associative Container LOGN, meaning that destroying (delete folowed by erase) single element or a range of elements is done in logarithmic time.
It is a Front Access Container meaning that the front of the list is available for retrieval, erasure and destruction in constant time.
It is a Back Access Container LOGN meaning that the back of the list is available for retrieval, erasure and destruction in logarithmic time.
The Unique Sorted Associative Container and Multiple Sorted Associative Container requirements guarantee that inserting a range takes only linear time if the range is already sorted. Unfortunately, this has not been implemented yet and performs in the default nlogn time.
A KeyedSSkipList
has the important property that inserting a new element into a KeyedSSkipList
does not invalidate iterators that point to existing elements. Erasing an element from a KeyedSSkipList
also does not invalidate any iterators, except, of course, for iterators that actually point to the element that is being erased.
A KeyedSSkipList
acts like a map
in functionality though the performance requirements are different in a few places.
A KeyedSSkipList
is a Reversible Container LOGN and uses a Bidirectional Iterator LOGN where decrementing takes logn time and incrementing takes constant time.
The iterator is also LessThan Comparable. See KeyedSSkipList::T0 for more info.
Defined in the custom header "CSKeyedSSkipList.h".
Parameter | Description | Default |
---|---|---|
K | The KeyedSSkipList 's key type. This is also defined as KeyedSSkipList::key_type . | |
T | The KeyedSSkipList 's data type. This is also defined as KeyedSSkipList::data_type . KeyedSSkipList::mapped_type is also defined to this value for convenience. | |
Pr | The key comparison function, a Strict Weak Ordering whose argument type is key_type ; it returns true if its first argument is less than its second argument, and false otherwise.This is also defined as KeyedSSkipList::key_compare . KeyedSSkipList::value_compare compares the key, but takes KeyedSSkipList::value_type as parameters. | less<K> |
R | The KeyedSSkipList 's random number generator, used for selection of levels per node. | RNG |
Pair Associative Container, Unique Sorted Associative Container, Associative Container LOGN, Destructive Associative Container LOGN, Reversible Container LOGN, Front Access Container and Back Access Container LOGN
T
is Assignable. Pr
is a Strict Weak Ordering whose argument type is K
. R
is an RNG (is Default Constructible and supports rand() and drand()). None.
Member | Where defined | Performance | Description |
---|---|---|---|
key_type | Associative Container LOGN | The key type, K . | |
data_type | Pair Associative Container | The type of object, T , associated with the keys. | |
value_type | Pair Associative Container | The type of object, pair<const key_type, data_type>, stored in the KeyedSSkipList . | |
key_compare | Sorted Associative Container | Function object that compares two keys for ordering. | |
value_compare | Sorted Associative Container | Function object that compares two values for ordering. | |
container_type | KeyedSSkipList | Type of this container | |
pointer | Container | Pointer to value_type . | |
reference | Container | Reference to value_type | |
const_reference | Container | Const reference to value_type | |
mapped_type | Pair Associative Container | A type identical to data_type and T . | |
mapped_type_reference | Pair Associative Container | Reference to data_type and T | |
const_mapped_type | Pair Associative Container | Const version of data_type and T | |
const_mapped_type_reference | Pair Associative Container | Const reference to data_type and T | |
size_type | Container | An unsigned integral type. | |
difference_type | Container | A signed integral type. | |
iterator | Container | Iterator used to iterate through the container's elements. [1] | |
const_iterator | Container | Const iterator used to iterate through the container's elements. | |
reverse_iterator | Reversible Container LOGN | Iterator used to iterate backwards through the container's elements. [1] | |
const_reverse_iterator | Reversible Container LOGN | Const iterator used to iterate backwards through the container's elements. | |
slpair | KeyedSSkipList | std::pair< iterator, bool > | |
iterator begin() | Container | O(1) | Returns an iterator pointing to the beginning of the container. |
iterator end() | Container | O(1) | Returns an iterator pointing to the end of the container. |
const_iterator begin() const | Container | O(1) | Returns a const_iterator pointing to the beginning of the container. |
const_iterator end() const | Container | O(1) | Returns a const_iterator pointing to the end of the container. |
reverse_iterator rbegin() | Reversible Container LOGN | O(1) | Returns a reverse_iterator pointing to the beginning of the reversed container. |
reverse_iterator rend() | Reversible Container LOGN | O(1) | Returns a reverse_iterator pointing to the end of the reversed container. |
const_reverse_iterator rbegin() const | Reversible Container LOGN | O(1) | Returns a const_reverse_iterator pointing to the beginning of the reversed container. |
const_reverse_iterator rend() const | Reversible Container LOGN | O(1) | Returns a const_reverse_iterator pointing to the end of the reversed container. |
size_type size() const | Container | O(1) | Returns the size of the container. |
size_type max_size() const | Container | O(1) | Returns the largest possible size of the container. |
bool empty() const | Container | O(1) | true if the container's size is 0 . |
key_compare key_comp() const | Sorted Associative Container | O(1) | Returns the key_compare object used by the container. |
value_compare value_comp() const | Sorted Associative Container | O(1) | Returns the value_compare object used by the container. |
KeyedSSkipList() | Container | O(1) | Creates an empty container. Default probability of 25% and 8 levels. |
KeyedSSkipList(size_type maxNodes) | KeyedSSkipList | O(1) | Creates an empty container. Default probability of 25%. Maximum levels based on maxNodes. |
KeyedSSkipList(double probability, size_type maxLevel) | KeyedSSkipList | O(1) | Create an empty container with the specified probability and maximum levels. |
KeyedSSkipList(const container_type &source) | Container | O(n*logn) | Copy constructor. Copies all elements along with probability and maximum levels. |
template<class InIt > | Unique Sorted Associative Container | O(n*logn) | Creates a container with a copy of the range. Probability is 25% and maximum levels is 8. |
template<class InIt > | Unique Sorted Associative Container w/ probability | O(n*logn) | Creates a container with the specified probability and maximum levels along with a copy of the range. |
template<class InIt > | Unique Sorted Associative Container w/ probability | O(n*logn) | Creates a container with a copy of the range. Default probability of 25%. Maximum levels based on maxNodes. |
KeyedSSkipList(const key_compare &comp) | Sorted Associative Container | O(1) | Creates an empty container, using comp as the key_compare object. |
template<class InIt > | Unique Sorted Associative Container | O(n*logn) | Creates a container with a copy of a range, using comp as the key_compare object. |
template<class InIt > | Unique Sorted Associative Container /w probability | O(n*logn) | Creates a container with a copy of a range, using comp as the key_compare object. Container is created with specified probability and maximum level. |
template<class InIt > | Unique Sorted Associative Container /w probability | O(n*logn) | Creates a container with a copy of a range, using comp as the key_compare object. Default probability of 25%. Maximum levels based on maxNodes. |
~KeyedSSkipList() | Container | O(n) | Destructor. Clears list. |
container_type& | Container | O(n) | The assignment operator |
void swap(container_type &right) | Container | O(1) | Swaps the contents of two containers. |
template<class InIt > | KeyedSSkipList | O(n*logn) | Clears all elements and copies range into container. |
std::pair< iterator, bool > | Unique Associative Container | O(logn) | Inserts val into the container. |
iterator insert(const iterator &where, | Unique Sorted Associative Container | O(logn) | DO NOT USE THIS!!! Inserts val into the container,using where as a hint to where it will be inserted. |
template<class InIt > | Unique Sorted Associative Container | O(n*logn) | Inserts a range into the container. Should be fixed to support O(n) when range is sorted. |
iterator erase(const iterator &where) | Associative Container LOGN | O(logn) | Erases the element pointed to by where . |
iterator destroy(const iterator &where) | Destructive Associative Container LOGN | O(logn) | Erases and deletes the element pointed to by where . |
size_type erase(const key_type &keyval) | Associative Container LOGN | O(logn) | Erases the element whose key is keyval . |
size_type destroy(const key_type &keyval) | Destructive Associative Container LOGN | O(logn) | Erases and deletes the element whose key is keyval . |
iterator erase(const iterator &first, const iterator &last) | Associative Container LOGN | O(n) | Erases all elements in a range. |
iterator destroy(const iterator &first, const iterator &last) | Destructive Associative Container LOGN | O(n) | Erases and deletes all elements in a range. |
void clear() | Associative Container LOGN | O(n) | Erases all of the elements. |
void destroy() | Destructive Associative Container LOGN | O(n) | Erases and deletes all of the elements. |
template<class Pr1 > | KeyedSSkipList | O(n) | Erases all elements where pred(*where) is true. |
template<class Pr4 > | KeyedSSkipList | O(n) | Destroys all elements where pred(*where) is true. |
void cut(const iterator &first, const iterator &last, | KeyedSSkipList | O(logn) | Extract nodes in the specified range [first,last) into right. |
reference front() | Front Access Container | O(1) | Returns the first element. |
const_reference front() const | Front Access Container | O(1) | Returns the first element. |
reference back() | Back Access Container LOGN | O(1) | Returns the last element. |
const_reference back() const | Back Access Container LOGN | O(1) | Returns the last element. |
void pop_front() | Front Access Container | O(1C/logn) | Removes the first element. |
void destroy_front() | Front Access Container | O(1C/logn) | Removes and deletes the first pointer element. |
void pop_back() | Back Access Container LOGN | O(1C/logn) | Removes the last element. |
void destroy_back() | Back Access Container LOGN | O(1C/logn) | Removes and deletes the last pointer element. |
iterator find(const key_type &keyval) | Associative Container LOGN | O(logn) | Finds an element whose key is keyval . |
const_iterator find(const key_type &keyval) const | Associative Container LOGN | O(logn) | Finds an element whose key is keyval . |
size_type count(const key_type &keyval) const | Unique Associative Container | O(logn) | Counts the number of elements whose key is keyval (0 or 1). |
iterator lower_bound(const key_type &keyval) | Sorted Associative Container | O(logn) | Finds the first element whose key is not less than keyval . |
const_iterator lower_bound(const key_type &keyval) const | Sorted Associative Container | O(logn) | Finds the first element whose key is not less than keyval . |
iterator upper_bound(const key_type &keyval) | Sorted Associative Container | O(logn) | Finds the first element whose key greater than keyval . |
const_iterator upper_bound(const key_type &keyval) const | Sorted Associative Container | O(logn) | Finds the first element whose key greater than keyval . |
std::pair< iterator, iterator > | Sorted Associative Container | O(logn) | Finds a range containing all elements whose key is keyval . |
std::pair< const_iterator, const_iterator > | Sorted Associative Container | O(logn) | Finds a range containing all elements whose key is keyval . |
mapped_type_reference | KeyedSSkipList | O(logn) | Returns a reference to the data associated with the specified key. |
const_mapped_type_reference | KeyedSSkipList | O(logn) | Returns a const_reference to the data associated with the specified key. |
mapped_type_reference | KeyedSSkipList | O(logn) | Returns a reference to the data associated with the specified key. |
const_mapped_type_reference | KeyedSSkipList | O(logn) | Returns a const_reference to the data associated with the specified key. |
bool operator==(const container&, | Forward Container | O(n) | Tests two maps for equality. This is a global function, not a member function. |
bool operator<(const container&, | Forward Container | O(n) | Lexicographical comparison. This is a global function, not a member function. |
[1] KeyedSSkipList::iterator
is not a mutable iterator, because KeyedSSkipList::value_type
is not Assignable. That is, if i
is of type KeyedSSkipList::iterator
and p
is of type KeyedSSkipList::value_type
, then *i = p
is not a valid expression. However, KeyedSSkipList::iterator
isn't a constant iterator either, because it can be used to modify the object that it points to for members that aren't used as part of the key. Using the same notation as above, i->member = p
is a valid expression. The same point applies to KeyedSSkipList::reverse_iterator
.
Iterator Overview, Bidirectional Iterator LOGN, Container, Simple Associative Container, Unique Sorted Associative Container, Multiple Sorted Associative Container, Associative Container, Associative Container LOGN, Sorted Associative Container, Destructive Associative Container LOGN, Pair Associative Container, Access Associative Container, Random Access Container LOGN Reversible Container, Reversible Container LOGN, Front Access Container, Back Access Container and Back Access Container LOGN