• Post Reply Bookmark Topic Watch Topic
  • New Topic

change while loop to recursion?

 
mike fusc
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


That is my code for a remove method that i created for a project and it works flawlessly, but I want to use recursion instead of the while loop. I just don't know where to start
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mike fusc wrote:... it works flawlessly

Then why mess with it?
 
Stephan van Hulst
Bartender
Posts: 6583
84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't worry about recursion. First, start giving all your variables (or at least your method signatures) meaningful names. cd, rmR and ptr simply won't do.
 
Mohamed Sanaulla
Bartender
Posts: 3166
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you want to use recursion? Are recursions better than loops?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!