Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Implementation of singly linked list algorithm. More...
#include <iostream>
#include <memory>
#include <string>
Classes | |
class | data_structures::linked_list::link |
class | data_structures::linked_list::list |
Namespaces | |
namespace | data_structures |
for IO operations | |
namespace | linked_list |
Functions for singly linked list algorithm. | |
Functions | |
bool | data_structures::linked_list::isDigit (const std::string &s) |
int | main () |
Implementation of singly linked list algorithm.
The linked list is a data structure used for holding a sequence of values, which can be added, removed and displayed.
Values can be added by iterating to the end of a list(by following the pointers) starting from the first link. Whichever link points to null is considered the last link and is pointed to the new value.
Values can be removed by also iterating through the list. When the node containing the value is found, the node pointing to the current node is made to point to the node that the current node is pointing to, and then returning the current node to heap store.
bool data_structures::linked_list::isDigit | ( | const std::string & | s | ) |
This function checks if the string passed consists of only digits.
s | To be checked if s contains only integers |
int main | ( | void | ) |
Main function: Allows the user add and delete values from the list. Also allows user to search for and display values in the list.