Add CMakeLists for all datastructs
+ Reorder, refactor comments
This commit is contained in:
18
cpp/datastructs/singlelist/CMakeLists.txt
Normal file
18
cpp/datastructs/singlelist/CMakeLists.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
|
||||
## About: An example of a singly linked list implementation ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
## CMakeLists.txt
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
# Define the project name
|
||||
project(SingleList)
|
||||
# Define source files
|
||||
set(SRC driver.cpp singlelist.cpp)
|
||||
# Build an executable
|
||||
add_executable(SingleListDriver ${SRC})
|
||||
@@ -68,7 +68,7 @@ SingleList::~SingleList()
|
||||
/** insert
|
||||
* @brief Inserts a value to the head of our linked list
|
||||
*
|
||||
* @param x The value to be inserted
|
||||
* @param val The value to be inserted
|
||||
*/
|
||||
bool SingleList::insert(int val)
|
||||
{
|
||||
@@ -81,7 +81,7 @@ bool SingleList::insert(int val)
|
||||
|
||||
/** insert at
|
||||
* @brief Inserts a value in the place of a given key
|
||||
* Key Node found is moved to the newNode->next positon
|
||||
* Key Node found is moved to the newNode->next position
|
||||
*
|
||||
* @param key The value to search for to determine insert location
|
||||
* @param val The value to be inserted into the list
|
||||
@@ -296,6 +296,7 @@ bool SingleList::replace(int val, int key, Node *&head)
|
||||
* @brief Find and return a Node which contains the given value
|
||||
*
|
||||
* @param val The value to search for within our SingleList
|
||||
* @param start The Node to start the search from
|
||||
* @return SingleList::Node* A pointer to the Node containing the search value
|
||||
*/
|
||||
SingleList::Node* SingleList::find(int val, Node *start) const
|
||||
@@ -317,6 +318,7 @@ SingleList::Node* SingleList::find(int val, Node *start) const
|
||||
* @brief Find and return the Node before a given value
|
||||
*
|
||||
* @param val The value to search for within our SingleList
|
||||
* @param start The Node to start the search from
|
||||
* @return SingleList::Node* A pointer to the Node previous to the given value
|
||||
*/
|
||||
SingleList::Node* SingleList::findPrevious(int val, Node *start) const
|
||||
|
||||
Reference in New Issue
Block a user