I have started dynamic programming,then i found that in most of the problems related to dynamic programming there is heavy use of recursion.So i thought to grip recursion,and I am finding it a bit difficult to tackle,So can anyone please help me in understanding how recursion works,and how to approach for the recuurence relation used in most of the recursion.Like i was trying to understand the solution of this problem via recursion

http://www.spoj.com/problems/DANGER/ (JOSEPHUS PROBLEM),

and i wonder how to come out the recuurence relation of such type of problems.

Thanks in Advance

1 Like

I would recommend Concrete Mathematics By-Graham,Knuth,Patashnik.

It have complete details on recursion and recurrence and also how to solve Josephus problem with different ways.

1 Like

The answer to your SPOJ problem : http://ideone.com/FUZQNO & https://ideone.com/6hf79H

You can always consider platforms like Stackoverflow for suck queries and yes you can google your queries too.

4 Likes

Thanks for the pdf . great help !

Can you share the pdf. That link is not working anymore.

1 Like

I actually read and deleted after reading .

Sorry ^ __ ^

No problem. That link is now working and I have downloaded it. Thanks.

ok no problem ^ __ ^