|
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
A class that implements a Circular Linked List. More...
Public Member Functions | |
| CircularLinkedList () | |
| Creates an empty CircularLinkedList. More... | |
| CircularLinkedList (const CircularLinkedList ©) | |
| Copy constructor for CircularLinkedList. More... | |
| CircularLinkedList (CircularLinkedList &&source) noexcept | |
| Move constructor for CircularLinkedList. More... | |
| CircularLinkedList & | operator= (const CircularLinkedList &other) |
| Copy assignment operator. More... | |
| CircularLinkedList & | operator= (CircularLinkedList &&other) noexcept |
| Move assignment operator. More... | |
| ~CircularLinkedList () | |
| Cleans up memory when destroyed. More... | |
| void | erase () |
| void | insert (const std::vector< int64_t > &values) |
| Inserts all the values from a vector into the Circular Linked List. More... | |
| void | insert (int64_t data) |
| Inserts a single value into the Circular Linked List. More... | |
| void | insert (Node *node) |
| Inserts a given Node into the Circular Linked List. More... | |
| void | print () |
| Prints the values of the Circular Linked List, beginning from the root Node. More... | |
| void | print (Node *root) |
| Prints the values of the Circular Linked List, beginning from a given Node to be used as the root. More... | |
| std::vector< int64_t > | values () |
| Returns a std::vector of the values of the Circular Linked List. More... | |
| std::vector< int64_t > | values (Node *root) |
| Returns a std::vector of the values of the Circular Linked List, beginning from a given Node. More... | |
Private Attributes | |
| Node * | root |
| Pointer to the root Node. | |
| Node * | end {} |
| Pointer to the last Node. | |
A class that implements a Circular Linked List.
|
inline |
Creates an empty CircularLinkedList.
|
inline |
Copy constructor for CircularLinkedList.
|
inlinenoexcept |
Move constructor for CircularLinkedList.
| source | rvalue reference to a Circular Linked List |
|
inline |
|
inline |
|
inline |
Inserts all the values from a vector into the Circular Linked List.
Goes through each element in the vector sequentially, inserting it into the list
| values | The vector of integer values that is to be inserted |
|
inline |
|
inline |
Inserts a given Node into the Circular Linked List.
Checks wheter the list is empty, and inserts the Node, modifying the end pointer
| node | The Node that is to be inserted |
< Set node as the root
< Point node to itself
< Set the end to the root
< Append node to the end
< Set the next value to the root
< Make end point to node
|
inlinenoexcept |
Move assignment operator.
| other | rvalue reference to a Circular Linked List |
|
inline |
Copy assignment operator.
| other | Reference to a Circular Linked List |
|
inline |
Prints the values of the Circular Linked List, beginning from the root Node.
Goes through each Node from the root and prints them out in order
|
inline |
|
inline |
Returns a std::vector of the values of the Circular Linked List.
Starting from the root Node, appends each value of the list to a std::vector and returns it
|
inline |
Returns a std::vector of the values of the Circular Linked List, beginning from a given Node.
Starting from a given Node, appends each value of the list to a std::vector and returns it
| root | The Node to start at |
< Return empty vector