Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

help with recursion?

i need some help with shortest path recursion.
a recursive function is given a and b (makes a rectangle) and the function returns how many different ways the character can move from tile to tile to reach the end goal.

what i'm having trouble with:
-the shortest path is always a+b - 1. how is this important?
-how would my recursion function know if a certain path is already counted?
-how does the recursion function keep track of how many different paths if it has to change the value of a and b to get to the end goal?

i'm probably looking at this wrong but if someone can point me to the right direction i can do all the work. i just don't understand what the relationships are.
If you don't have a defined prototype and work with a language which have some concepts of abstraction, you could just add a variable to the prototype and store paths there.

If you do have a defined prototype, I think I''m either missing something or I lack information to help you.
I'll suggest you take a look at recursive descent algorithm, it's used in parsing code, however same concept can be used for various stuff.
Also you could use graphs and their algorithms too bad I don't remember any right now to name them.
Have a cool signature? hit me up and I might use it.


Possibly Related Threads...
Thread / Author Replies Views Last Post
by J. McCarthyNov 10, 2016 03:15 PM 0 90 Nov 10, 2016 03:15 PM
Last Post: J. McCarthy
by Marilyn MansonApr 26, 2016 03:00 AM 0 57 Apr 26, 2016 03:00 AM
Last Post: Marilyn Manson
[Help] by pitcher654Nov 28, 2015 10:04 AM 3 129 Nov 28, 2015 10:04 AM
Last Post: Remix