This was a homework question I had.
Consider this java pseudocode
string rep (int n){ ---> n is a natural number in this case.
if(n==0)
return "0";
if(n==1)
return "1";
string w = rep(n/2);
if(n%2==0)
return append (w,'0');
else
return append (w,'1');
}
If I call this method on argument (decimal) 637, what is the first two(decimal)-digit argument of a recursive call?
I am confused on what an argument means in this instance. It seems that I can just divide 637 by 8 and get 79. Would this be correct?
append? And what should the pseudocode do ?nis an argument. This program converts a number to binary.w + cSystem.out.println(n);instruction at the beginning of the method, and see what the first 2-digit printed number is.