× Didn't find what you were looking for? Ask a question
Top Posters
Since Sunday
s
3
v
3
p
3
m
2
s
2
d
2
N
2
d
2
e
2
s
2
s
2
e
2
New Topic  
Stromile Stromile
wrote...
Posts: 299
Rep: 0 0
6 years ago
The following two methods will both compute the same thing when invoked with the same value of x.  That is, method1(x) = = method2(x).
   public int method1(int x)
   {
      if (x > 0) return method1(x - 1) + 1;
      else return 0;
   }

   public int method2(int x)
   {
      if (x > 0) return 1 + method2(x - 1);
         else return 0;
   }
Read 37 times
1 Reply
Replies
Answer verified by a subject expert
StingerStinger
wrote...
Posts: 310
Rep: 4 0
6 years ago
Sign in or Sign up in seconds to unlock everything for free
1

Related Topics

Stromile Author
wrote...

6 years ago
This helped my grade so much Perfect
wrote...

Yesterday
Thanks
wrote...

2 hours ago
Helped a lot
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  870 People Browsing
Related Images
  
 285
  
 246
  
 1020
Your Opinion
What's your favorite funny biology word?
Votes: 401