That
recursiveSearch()
function is gonna need two more things; firstly a way to return did not find. It's probably best to return a std::optional
here, with the value unset if it did not find the value. Second the function will need to stop at the end of the list, when node == nullptr
. That's a good place to return the did not find condition.