TheAlgorithms/C++ 1.0.0
All the 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
Definition at line 68 of file reverse_a_linked_list.cpp.
|
inline |
List constructor. Initializes the first and last link.
Definition at line 89 of file linked_list.cpp.
list::~list | ( | ) |
Definition at line 196 of file reverse_a_linked_list.cpp.
data_structures::linked_list::list::list | ( | const list & | other | ) |
copy constructor creating a deep copy of every node of the input
Definition at line 206 of file reverse_a_linked_list.cpp.
|
private |
Definition at line 198 of file reverse_a_linked_list.cpp.
|
private |
calls delete operator on every node in the represented list
Definition at line 188 of file reverse_a_linked_list.cpp.
void data_structures::linked_list::list::display | ( | ) |
function displays all the elements in the list
Definition at line 181 of file linked_list.cpp.
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 |
Definition at line 152 of file linked_list.cpp.
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 |
Definition at line 99 of file reverse_a_linked_list.cpp.
bool data_structures::linked_list::list::isEmpty | ( | ) |
function checks if list is empty
Definition at line 111 of file linked_list.cpp.
bool data_structures::linked_list::list::isEmpty | ( | ) | const |
Utility function that checks if the list is empty.
Definition at line 93 of file reverse_a_linked_list.cpp.
assignment operator creating a deep copy of every node of the input
Definition at line 211 of file reverse_a_linked_list.cpp.
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 |
Definition at line 123 of file linked_list.cpp.
void data_structures::linked_list::list::push_front | ( | int | new_elem | ) |
function adds new element to the beginning of the list
new_elem | to be added to front of the list |
Definition at line 137 of file linked_list.cpp.
void data_structures::linked_list::list::reverseList | ( | ) |
Utility function for reversing a list.
Using the current, previous, and next pointer.
Definition at line 125 of file reverse_a_linked_list.cpp.
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 |
Definition at line 197 of file linked_list.cpp.
int32_t data_structures::linked_list::list::top | ( | ) | const |
Utility function to find the top element of the list.
Definition at line 142 of file reverse_a_linked_list.cpp.
int32_t data_structures::linked_list::list::traverse | ( | int32_t | index | ) | const |
Utility function to find the i th element of the list.
Definition at line 168 of file reverse_a_linked_list.cpp.
|
private |
link before the actual first element
Definition at line 83 of file linked_list.cpp.
|
private |
Definition at line 70 of file reverse_a_linked_list.cpp.
|
private |
last link on the list
Utility function to find the last element of the list.
Definition at line 84 of file linked_list.cpp.