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

Iterator class. More...

#include <skip_list.h>

Public Member Functions

 Iterator (std::shared_ptr< node > ptr) noexcept
 Construct a new Iterator object.
 
Iteratoroperator= (std::shared_ptr< node > current)
 = operator for Iterator type*
 
Iteratoroperator++ ()
 operator ++
 
Iterator operator++ (int)
 operator ++ for type Iterator
 
bool operator!= (const Iterator &it)
 operator != for type Iterator
 
operator* ()
 operator * for type Iterator
 
 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 >::Iterator

Iterator class.

Constructor & Destructor Documentation

◆ Iterator()

template<typename T>
skip_list< T >::Iterator::Iterator ( std::shared_ptr< node > ptr)
inlineexplicitnoexcept

Construct a new Iterator object.

Parameters
ptrpointer to the node

Member Function Documentation

◆ begin()

Iterator skip_list< T >::begin ( )
inline

pointer that points to the first element of the list

Returns
Iterator

◆ end()

Iterator skip_list< T >::end ( )
inline

pointer that points to the last element of the list

Returns
Iterator

◆ insert()

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

insert function.

Parameters
keykey to be inserted.

◆ operator!=()

template<typename T>
bool skip_list< T >::Iterator::operator!= ( const Iterator & it)
inline

operator != for type Iterator

Parameters
itpointer to the node
Returns
bool

◆ operator*()

template<typename T>
T skip_list< T >::Iterator::operator* ( )
inline

operator * for type Iterator

Returns
T

◆ operator++() [1/2]

template<typename T>
Iterator & skip_list< T >::Iterator::operator++ ( )
inline

operator ++

Returns
Iterator

◆ operator++() [2/2]

template<typename T>
Iterator skip_list< T >::Iterator::operator++ ( int )
inline

operator ++ for type Iterator

Returns
Iterator

◆ operator=() [1/2]

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

operator = for the skip_list class

Parameters
sthe list we want to copy
Returns
skip_list&

◆ operator=() [2/2]

template<typename T>
Iterator & skip_list< T >::Iterator::operator= ( std::shared_ptr< node > current)
inline

= operator for Iterator type*

Parameters
currentpointer to the node
Returns
Iterator&

◆ remove()

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

remove function.

Parameters
keykey to be removed(if exist).

◆ search()

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

search function.

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

◆ skip_list() [1/2]

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

Copy constructor for the skip_list class.

Parameters
s

◆ skip_list() [2/2]

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).

Friends And Related Symbol Documentation

◆ operator<<

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: