Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Public Member Functions | |
list () | |
bool | isEmpty () |
Utility function that checks if the list is empty. More... | |
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 () |
list () | |
bool | isEmpty () |
void | insert (int32_t new_elem) |
Utility function that adds a new element at the end of the list. More... | |
void | reverseList () |
Utility function for reversing a list. More... | |
void | display () |
int32_t | top () |
Utility function to find the top element of the list. More... | |
int32_t | last () |
int32_t | traverse (int32_t index) |
Utility function to find the i th element of the list. More... | |
Private Attributes | |
std::shared_ptr< link > | first |
link before the actual first element | |
std::shared_ptr< link > | last |
last link on the list More... | |
Node * | head |
A list class containing a sequence of links
|
inline |
List constructor. Initializes the first and last link.
|
inline |
List constructor. Initializes the first link.
void list::display | ( | ) |
function displays all the elements in the list
void list::erase | ( | int | old_elem | ) |
function erases old element from the list
old_elem | to be erased from the list |
void 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 list::isEmpty | ( | ) |
Utility function that checks if the list is empty.
function checks if list is empty
void list::push_back | ( | int | new_elem | ) |
void 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 |
void list::reverseList | ( | ) |
Utility function for reversing a list.
Using the current, previous, and next pointer.
std::shared_ptr< link > list::search | ( | int | find_elem | ) |
function searchs for
find_elem | in the list |
find_elem | to be searched for in the list |
int32_t list::top | ( | ) |
Utility function to find the top element of the list.
int32_t list::traverse | ( | int32_t | index | ) |
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.