File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion 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: 9059
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....

I agree. Here's the link:
subject: Recursive vs Iterative in 4b Say
It's not a secret anymore!