Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

in python i need to make this code into this recursive code ## NON-RECURSIVE COD

ID: 3750199 • Letter: I

Question

in python i need to make this code

into this recursive code

## NON-RECURSIVE CODE WE ARE REPLACING def search (self, targetItem): if self._current- None and self._current.getData) targetItem: return True self._previous None self._current self.head self._currentIndex0 while self._currentNone: if self._current.getData)targetItem: return True elif self._current.getData() > targetItem: return False #inch-worm down list self._previous self._current self._current self._current.getNext () self._currentIndex1 else: return False

Explanation / Answer

We need to update recursively the self._current,self._previous and self._currentIndex

def searchHelper():
if(self._current==NULL):return False
if(self._current.getData()==targetItem):return True
if(self._current.getData()>targetItem):return False
# If none of the above are true then we proceed to need node in linked list
self._previous=self._current
self._current=self._current.getNext()
self._currentIndex+=1
return searchHelper()

So our code is just doing recursion from start to end untill it reaches null or higher value it keeps on iterating and when it sees them it returns false. When it sees a number it returns true

If you have anyother doubts we can discuss in comment section