Hello All,
I am trying to figure out how to use recursion in programs. I understand how recursion works in classical examples like "factorial", but am not sure how to apply it on my own...
I am starting out with converting an iterative bubble sort code into a recursive code... I have searched over the net for the same.... but am not able to find a convincing solution/explanation..
The iterative code for bubble sort is:
arr[n]-> array with n elements which is to be sorted
for(i:1 to n) for(j:1 to n) if(arr[i]>arr[j]) swap(arr[i],arr[j]);
Would feel helpful if someone could give a hint about how to go about...