Link lists have been favorite  question asked in interview. The efficient answer by professionals makes positive response as well it is sign of good concepts. there are two method of reversing singly link list.

  • iterative

 

  • recursion

Recursive solution looks clean but it is always hard to think as our mind always thinks in iterative way. in c/cpp programming if a function calls itself then we name this type of function recursive.  recursive solution needs one case where function stops calling itself, that case may be called base case.

Best example is factorial program. factorial of a number is the product of all numbers less than equal to itself, like factorial of 5 is 5*4*3*2*1.