- #1
shivajikobardan
- 674
- 54
- Homework Statement
- thinking about recursion in programming for palindrome checker
- Relevant Equations
- none
I got the idea for problems like factorials or finding sum from 1 to n, where there's a pattern visible. Like this:
Source:https://99x.io/blog/recursion-is-not-hard-here-is-the-right-way-to-think
I got it for things like addition, subtraction, division, multiplication of two numbers as well.
eg: a+b
=a+b-1+1
=SUM(a+1,b-1)
Now, I am wondering how it'll be for finding a palindrome of a number? I've a solution but I'm not understanding how we came towards it. I'm looking for how to come towards a solution than a solution itself.
A number is palindrome if it's same as it's reversed. eg: REFER, RADAR, NOON etc are palindrome strings.
I'm unable to grasp a pattern here. Also, please share some books based on mathematics(Not full books but part of book on recursion) that have exercises of recursive functions. I think that'd help greatly with recursion.
Source:https://99x.io/blog/recursion-is-not-hard-here-is-the-right-way-to-think
I got it for things like addition, subtraction, division, multiplication of two numbers as well.
eg: a+b
=a+b-1+1
=SUM(a+1,b-1)
Now, I am wondering how it'll be for finding a palindrome of a number? I've a solution but I'm not understanding how we came towards it. I'm looking for how to come towards a solution than a solution itself.
A number is palindrome if it's same as it's reversed. eg: REFER, RADAR, NOON etc are palindrome strings.
I'm unable to grasp a pattern here. Also, please share some books based on mathematics(Not full books but part of book on recursion) that have exercises of recursive functions. I think that'd help greatly with recursion.