This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Cattle Drive and the fly likes Recursive vs Iterative in 4b Say Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Recursive vs Iterative in 4b Say" Watch "Recursive vs Iterative in 4b Say" New topic

Recursive vs Iterative in 4b Say

Julie Purcell

Joined: Apr 18, 2004
Posts: 5
I have just rejoined the cattle drive and the last feedback I got on this assignment was that an iterative approach would be better than a recursive approach but I'm not sure what this means in the context of my code to date.

I currently use a while loop to pick out the first three numbers from the right, the next 3 etc and was also asked to try and think from left to right rather than from right to left.

Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9044
I got your assignment just before my computer died again. The nitpicker must have been really tired when it was done because I didn't see any recursion. However, going from right to left rather than from left to right has been discussed here before. When I have a few more minutes, I'll try to do a search in this forum to see if I can find one of those discussions for you unless you get to it before then.

(I'll be working later today on getting the info off my other hard drive onto one that works consistently.)
[ March 18, 2006: Message edited by: Marilyn de Queiroz ]

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Julie Purcell

Joined: Apr 18, 2004
Posts: 5
Thanks for feedback Marilyn and for forwarding on 4a too. I finally understand why we should go from left to right so will hopefully be forwarding my next attempt shortly....

It is sorta covered in the JavaRanch Style Guide.
subject: Recursive vs Iterative in 4b Say