Results 1 to 12 of 12
Thread: recursive function
 09022010, 01:11 PM #1Member
 Join Date
 Sep 2010
 Posts
 8
 Rep Power
 0
 09022010, 01:18 PM #2
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,422
 Blog Entries
 7
 Rep Power
 29
 09022010, 01:27 PM #3Member
 Join Date
 Sep 2010
 Posts
 8
 Rep Power
 0
i got as far as writing a recursive function that is extremly simple
BEGIN count(num)
IF num<3
print num
count (n+1)
END IF
END Count
but i cant seem to adapt the aspects of this algorithim into it any help/ pointers would be great
 09022010, 01:30 PM #4Member
 Join Date
 Sep 2010
 Posts
 8
 Rep Power
 0
it would be greatly appreciated if you could step me through the process of changing the algorithim to a recursive function. iam new to software development so please bare with me
 09022010, 02:38 PM #5Member
 Join Date
 Sep 2010
 Posts
 8
 Rep Power
 0
is their anyone who can help me out all i need is two or three lines of code and my problem is solved, please help me out
 09022010, 02:55 PM #6
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,422
 Blog Entries
 7
 Rep Power
 29
You recursive method should have a structure like this:
Java Code:BEGIN program(num1, num2) IF (num2 == 0) RETURN num1 return program( ... , ...)
kind regards,
Jos
 09022010, 03:02 PM #7Member
 Join Date
 Sep 2010
 Posts
 8
 Rep Power
 0
thank you very much appreciated
 09022010, 03:30 PM #8Member
 Join Date
 Sep 2010
 Posts
 8
 Rep Power
 0
BEGIN program (num1, num2)
declare num3 as int
IF(num2 == 0) RETURN num1
return program(num1/num2) to num3
(num1 to num2)
(num2 to num3)
ENDIF
Return num1
END program
hopefully this will work if not give me one more pointer in the right direction:)
cheers jayden
 09022010, 03:45 PM #9
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,422
 Blog Entries
 7
 Rep Power
 29
 09022010, 03:49 PM #10Member
 Join Date
 Sep 2010
 Posts
 8
 Rep Power
 0
what happened to num 3
 09022010, 03:54 PM #11
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,422
 Blog Entries
 7
 Rep Power
 29
 09022010, 04:00 PM #12Member
 Join Date
 Sep 2010
 Posts
 8
 Rep Power
 0
Similar Threads

basic help with Recursive
By syntrax in forum New To JavaReplies: 3Last Post: 12152009, 07:19 AM 
Possible? Callback function passed as arguments to another function
By TreyAU21 in forum Advanced JavaReplies: 3Last Post: 12042009, 04:08 PM 
Recursive Counting
By zlwilly in forum New To JavaReplies: 1Last Post: 01292009, 09:42 PM 
Understanding this recursive function
By LifeWithJava in forum New To JavaReplies: 3Last Post: 12302008, 06:26 AM 
Help with recursive function in java
By cachi in forum Advanced JavaReplies: 2Last Post: 07312007, 07:51 PM
Bookmarks