How do you trace this recursive method? HELP?

public static void mystery1 ( int a , int b) {
if ( a = < b) {
int m =(a + b) / 2 ;
System. out. pr i nt (m + " " ) ;
mystery1 ( a , m-1) ;
mystery1 (m+1, b) ;

public s tat ic void main ( St r ing [ ] args ){
int n = 6 ;
mystery1 ( 0 , n ) ;


Most Helpful Guy

  • do you have too many spaces in print and after the.

    • download a program called eclipse and it will tell you what line of code is breaking

    • my problem is not with the code running or not
      I wanna trace it

    • But what exactly do you want to trace?

      Most debuggers and IDE's with debuggers allow you to trace programs, set breakpoints, and see what's inside certain variables at certain points.

Most Helpful Girl

  • Why are you posting coding issues on this site? Go to stack overflow or something.

    Also, I'm pretty sure that "a => b" should be "a >= b".

    • They'd just tell her to use a debugger.

    • Show All
    • The problem is that they're using a function similar to htmlentities () to convert certain symbols to their HTML entity symbols. But I think they did it double. Like, the CMS they're using already takes care of it, but then they do it again themselves so you literally get the HTML entities displayed as text. That's what's causing "<" to appear sometimes.

    • If you open and close an angular bracket then it literally gets removed, that's why what I started typing after the semi-colon just magically vanished. :P I don't think they're just escaping it with htmlentities () [although I personally would recommend he. js], because some stuff gets duplicated, overwritten, etc. I think this is homemade.

Have an opinion?

What Guys Said 1

What Girls Said 0

The only opinion from girls was selected the Most Helpful Opinion, but you can still contribute by sharing an opinion!