can we also assume in that if 3 nodes are there mean n for n-1 the recursion will reverse the linked list and for nth we have to prove that?
Reverse linked list
@Vikaspal hey ,no you dont have to proove that for n ,think like this:assume that recursion will give answer for n-1 elements or reverse the linked list after head .Now you have to work on your head,now attch this head to last of that reversed linked list and it is done,think in this way only that recursion will do its work that is small calculation and you have to perform larger calculation or calculation on remaining part,hope you get it.Happy coding
@rishabhmahajan546 thanks bhai.
But while solving some recursion problem i found the pattern like this take an example of
printing the increasing and decreasing sequence
let n = 5
1 2 3 4 5
1 2 3 4 recursive will do it means for n-1 then
we just have to print the n number. like way
Hoping u got my point brother
@Vikaspal hey bro ,every problem cant be solved like that,in the eg problem if you assume recursion will do work then you also have to do calculation on current element ,in this ap khali first wala print krdoge aisa nhi chlega as first element may be in increasing sequence or decreasing ,so har problem ko aise mt socho,every recursion problem me ye soch skte ho.