AlgoPlus v0.1.0
Loading...
Searching...
No Matches
skip_list< T > Class Template Reference

skip_list class. More...

#include <skip_list.h>

Classes

class  Iterator
 Iterator class. More...
 

Public Member Functions

 skip_list (int MAX_LEVEL, float PROB)
 skip_list constructor.
 
 skip_list (const skip_list &s)
 Copy constructor for the skip_list class.
 
skip_listoperator= (const skip_list &s)
 operator = for the skip_list class
 
 ~skip_list () noexcept
 Destroy the skip list object.
 
void insert (T key)
 insert function.
 
Iterator begin ()
 pointer that points to the first element of the list
 
Iterator end ()
 pointer that points to the last element of the list
 
void remove (T key)
 remove function.
 
bool search (T key)
 search function.
 

Friends

std::ostream & operator<< (std::ostream &out, skip_list< T > &l)
 visualize function returns a .dot file that can be previewd with graphviz plugin in vscode
 

Detailed Description

template<typename T>
class skip_list< T >

skip_list class.

Constructor & Destructor Documentation

◆ skip_list() [1/2]

template<typename T >
skip_list< T >::skip_list ( int MAX_LEVEL,
float PROB )
inlineexplicit

skip_list constructor.

Parameters
__MAX_LEVELmax height of the list.
__PROBprobability of increasing the height each time(by default it should be 0.5).

◆ skip_list() [2/2]

template<typename T >
skip_list< T >::skip_list ( const skip_list< T > & s)
inline

Copy constructor for the skip_list class.

Parameters
s

Member Function Documentation

◆ begin()

template<typename T >
Iterator skip_list< T >::begin ( )
inline

pointer that points to the first element of the list

Returns
Iterator

◆ end()

template<typename T >
Iterator skip_list< T >::end ( )
inline

pointer that points to the last element of the list

Returns
Iterator

◆ insert()

template<typename T >
void skip_list< T >::insert ( T key)
inline

insert function.

Parameters
keykey to be inserted.

◆ operator=()

template<typename T >
skip_list & skip_list< T >::operator= ( const skip_list< T > & s)
inline

operator = for the skip_list class

Parameters
sthe list we want to copy
Returns
skip_list&

◆ remove()

template<typename T >
void skip_list< T >::remove ( T key)
inline

remove function.

Parameters
keykey to be removed(if exist).

◆ search()

template<typename T >
bool skip_list< T >::search ( T key)
inline

search function.

Parameters
keykey to be searched.
Returns
true if the key exists in the list.

Friends And Related Symbol Documentation

◆ operator<<

template<typename T >
std::ostream & operator<< ( std::ostream & out,
skip_list< T > & l )
friend

visualize function returns a .dot file that can be previewd with graphviz plugin in vscode

operator << for skip_list<T> class.


The documentation for this class was generated from the following file: