Need Help Fixing Recursion Code Attempted Solution Integerlinkedlistcpp However T Seem Fig Q43788170
Need help fixing the recursion to this code. I attempted the solution below on IntegerLinkedList.cpp, however, I can’t seem to figure it out. The missing part of the code prob3.cpp is given to us which is basically testing the following two codes below that I need help figuring out.We are to recursively return true or false if any of the numbers in the array are in fact a positive number.For example: -2 -30 -22 -12 4 -99would return True.while: -12 -67 -54 -23 -1 -6would return False.************************************************************************************************************************************************IntengerLinkedList.h#pragma onceclass SNode {public: int elem; SNode *next;};class IntegerLinkedList {private: SNode *head; bool checkRecurse (SNode *ptr); // for Problem 3; Implement in prob3.cpppublic: IntegerLinkedList(): head(nullptr) {} void addFront(int x); // recursion helper function called from main for PROBLEM 3 bool checkRecurseHelper ();};************************************************************************************************************************************************IntegerLinkedList.cpp#include “IntegerLinkedList.h”#include “prob3.cpp”bool IntegerLinkedList::checkRecurse (SNode *ptr) { // COMPLETE THIS FOR PROBLEM 3if(ptr == nullptr)return 0;//return ptr->elem + checkRecurse(ptr->next); //TESTING THISif((checkRecurse(ptr->next) >= 1)) //TRIED TO GO THROUGH LINKE LISTreturn false; // IF A NUBMER WAS POSITIVE IT WOULD RETURN THE FALSE // OTHERWISE IT WOULD BE TRUE.return true;}void IntegerLinkedList::addFront(int x) { SNode *tmp = head; head = new SNode; head->next = tmp; head->elem = x;}// recursion helper function called from main for PROBLEM 3bool IntegerLinkedList::checkRecurseHelper () { return checkRecurse(head);}
***********************************************************************************************************************************************************************************************************
Expert Answer
Answer to Need help fixing the recursion to this code. I attempted the solution below on IntegerLinkedList.cpp, however, I can’t …
OR