bubble v0.0.1
Loading...
Searching...
No Matches
bubble< T, _SIZE > Class Template Reference

Implementation of the bubble data structure, a data structure that is highly influenced from the fibonacci heap structure. Bubble uses an array and avl_trees to store elements and fastly retreieve or insert new ones. Insertion/removal time complexity is O(logn + logm) == O(log(n + m)) where n is the size of the initial array(or the input bubble size) and m is the number of nodes at the index that the bubble is going to search. More...

#include <bubble.h>

Classes

class  iterator
 

Public Member Functions

 bubble () noexcept
 default constructor of bubble
 
template<size_t _NEW_SIZE>
 bubble (const bubble< T, _NEW_SIZE > &t)
 copy constructor of bubble
 
template<size_t _NEW_SIZE>
const bubble operator= (bubble< T, _NEW_SIZE > &t)
 operator = for bubble class
 
template<typename... Args>
void insert (Args ...keys)
 insert function for bubble
 
template<typename... Args>
void remove (Args ...keys)
 remove function for bubble
 
bool search (const T &key)
 search function for bubble
 
get_key (const size_t &index) const
 get_key function
 
avl_tree< T > get_tree (const size_t &index) const
 get_tree function
 
iterator begin () noexcept
 begin iterator
 
iterator end () noexcept
 end iterator
 
size_t size () const
 size function for bubble
 
size_t array_size () const
 array_size function for bubble
 
bool empty () const
 empty function for bubble
 
std::pair< T, std::vector< T > > operator[] (const size_t &index) const
 operator [] for bubble
 

Friends

std::ostream & operator<< (std::ostream &out, const bubble< T, _SIZE > &t)
 operator << for bubble
 

Detailed Description

template<typename T, size_t _SIZE>
class bubble< T, _SIZE >

Implementation of the bubble data structure, a data structure that is highly influenced from the fibonacci heap structure. Bubble uses an array and avl_trees to store elements and fastly retreieve or insert new ones. Insertion/removal time complexity is O(logn + logm) == O(log(n + m)) where n is the size of the initial array(or the input bubble size) and m is the number of nodes at the index that the bubble is going to search.

implementation of bubble<T, SIZE>

Constructor & Destructor Documentation

◆ bubble()

template<typename T , size_t _SIZE>
template<size_t _NEW_SIZE>
bubble< T, _SIZE >::bubble ( const bubble< T, _NEW_SIZE > & t)
inline

copy constructor of bubble

Parameters
tconst& bubble<T, _NEW_SIZE>: the new bubble

Member Function Documentation

◆ array_size()

template<typename T , size_t _SIZE>
size_t bubble< T, _SIZE >::array_size ( ) const

array_size function for bubble

Returns
size_t: the size of the array

◆ begin()

template<typename T , size_t _SIZE>
iterator bubble< T, _SIZE >::begin ( )
inlinenoexcept

begin iterator

Returns
an iterator to the beginning of the list

◆ empty()

template<typename T , size_t _SIZE>
bool bubble< T, _SIZE >::empty ( ) const

empty function for bubble

Returns
true: if bubble is empty
false: otherwise

◆ end()

template<typename T , size_t _SIZE>
iterator bubble< T, _SIZE >::end ( )
inlinenoexcept

end iterator

Returns
an iterator to the ending of the list

◆ get_key()

template<typename T , size_t _SIZE>
T bubble< T, _SIZE >::get_key ( const size_t & index) const

get_key function

Parameters
indexconst size_t& the index
Returns
T: the element of the array in that index

◆ get_tree()

template<typename T , size_t _SIZE>
avl_tree< T > bubble< T, _SIZE >::get_tree ( const size_t & index) const

get_tree function

Parameters
indexconst size_t& the index
Returns
avl_tree<T>: the AVL Tree in that index

◆ insert()

template<typename T , size_t _SIZE>
template<typename... Args>
void bubble< T, _SIZE >::insert ( Args ... keys)
inline

insert function for bubble

Parameters
Argsthe keys you want to insert. You can insert as many as you like bubble.insert(1, 2, 3, 4, ...)

◆ operator=()

template<typename T , size_t _SIZE>
template<size_t _NEW_SIZE>
const bubble bubble< T, _SIZE >::operator= ( bubble< T, _NEW_SIZE > & t)
inline

operator = for bubble class

Parameters
tconst& bubble<T, _NEW_SIZE> the new bubble
Returns
: const bubble

◆ operator[]()

template<typename T , size_t _SIZE>
std::pair< T, std::vector< T > > bubble< T, _SIZE >::operator[] ( const size_t & index) const
inline

operator [] for bubble

Parameters
indexconst size_t&, the passed index value
Returns
std::vector<T>: the elements in-order of the passed index

◆ remove()

template<typename T , size_t _SIZE>
template<typename... Args>
void bubble< T, _SIZE >::remove ( Args ... keys)

remove function for bubble

Parameters
Argsthe keys you want to remove. You can remove as many as you like bubble.remove(1, 2, 3, 4, ...)

◆ search()

template<typename T , size_t _SIZE>
bool bubble< T, _SIZE >::search ( const T & key)

search function for bubble

Parameters
keythe key you want to search
Returns
true: if key exists in the bubble
false: otherwise

◆ size()

template<typename T , size_t _SIZE>
size_t bubble< T, _SIZE >::size ( ) const

size function for bubble

Returns
size_t: the size of the bubble

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