Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Public Member Functions | |
list () | |
bool | isEmpty () |
void | push_back (int new_elem) |
void | push_front (int new_elem) |
void | erase (int old_elem) |
void | display () |
std::shared_ptr< link > | search (int find_elem) |
void | reverse () |
bool | isEmpty () const |
Utility function that checks if the list is empty. | |
void | insert (int32_t new_elem) |
Utility function that adds a new element at the end of the list. | |
void | reverseList () |
Utility function for reversing a list. | |
void | display () const |
int32_t | top () const |
Utility function to find the top element of the list. | |
int32_t | last () const |
int32_t | traverse (int32_t index) const |
Utility function to find the i th element of the list. | |
list (const list &other) | |
copy constructor creating a deep copy of every node of the input | |
list & | operator= (const list &other) |
assignment operator creating a deep copy of every node of the input | |
Private Member Functions | |
void | delete_all_nodes () |
calls delete operator on every node in the represented list | |
void | copy_all_nodes_from_list (const list &other) |
Private Attributes | |
std::shared_ptr< link > | first |
link before the actual first element | |
std::shared_ptr< link > | last |
last link on the list | |
Node * | head = nullptr |
A list class containing a sequence of links
|
inline |
List constructor. Initializes the first and last link.
list::~list | ( | ) |
data_structures::linked_list::list::list | ( | const list & | other | ) |
copy constructor creating a deep copy of every node of the input
|
private |
|
private |
calls delete operator on every node in the represented list
void data_structures::linked_list::list::display | ( | ) |
function displays all the elements in the list
void data_structures::linked_list::list::erase | ( | int | old_elem | ) |
function erases old element from the list
old_elem | to be erased from the list |
void data_structures::linked_list::list::insert | ( | int32_t | n | ) |
Utility function that adds a new element at the end of the list.
new_elem | element be added at the end of the list |
bool data_structures::linked_list::list::isEmpty | ( | ) |
function checks if list is empty
bool data_structures::linked_list::list::isEmpty | ( | ) | const |
Utility function that checks if the list is empty.
assignment operator creating a deep copy of every node of the input
void data_structures::linked_list::list::push_back | ( | int | new_elem | ) |
function adds new element to the end of the list
new_elem | to be added to the end of the list |
void data_structures::linked_list::list::push_front | ( | int | new_elem | ) |
void data_structures::linked_list::list::reverseList | ( | ) |
Utility function for reversing a list.
Using the current, previous, and next pointer.
std::shared_ptr< link > data_structures::linked_list::list::search | ( | int | find_elem | ) |
function searchs for
find_elem | in the list |
find_elem | to be searched for in the list |
int32_t data_structures::linked_list::list::top | ( | ) | const |
Utility function to find the top element of the list.
int32_t data_structures::linked_list::list::traverse | ( | int32_t | index | ) | const |
Utility function to find the i th element of the list.
|
private |
last link on the list
Utility function to find the last element of the list.