I am looking to do it with Python. And I don\'t want to just print it in reverse, but actually reverse the given nodes. I have seen it done in other languages but had trouble fi
def reverse_ll_pass(self):
temp = self.head
if temp is None:
return
return self.reverse_ll_recursive(temp,past=None)
def reverse_ll_recursive(self,curr,past):
if curr is None:
self.head = past
return self.head
else:
future = curr.next
curr.next = past
past = curr
curr = future
return self.reverse_ll_recursive(curr,past)