Is this alternative code correct?

public static void PDISkip(int n)
{
sysout(n);
if(n==1){return;}
PDISkip(n-2);
sysout(n-1);
}
It is just a pseudo code for the logic

Hi @aparna34,
this code will work fine if the input n is odd but if the input is even the this code will print the even number first and then the odd numbers so in that case the logic will be reversed.and also if the input is even then the code will never stop as the code will stop if n==1 and in case of even n , n will become first 2 and then 0.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Hello,
I needed help in one more doubt as I am unable to access doubt button in my Data Science course. Can you help me build spark code(with transformations) for Matrix Multiplication in One MapReduce step.
Thanks