Public Group

# Recursion and a little more..

This topic is 4843 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

For the past hour I have been studying Recursion, as I began to practice I started thinking of a method that would look like this:
[SOURCE]

int main()
{
for (i = 1; i <= Divs; i++)
{
function(one, two, three, level);
cout << ruler << "\n";
}
}
void function(int a, int b, int c, int stage)
{
if (stage == 0)
return;
//some funky code what ever..
anotherFunction( a, b, c, d );
function(ar, low, mid, level - 1);
function(ar, mid, high, level - 1);
}

void anotherFunction( int uno, int dos, int tres, int var)
{
if (var == 0)
return;
//some funky code what ever..
anotherFunction( a, b, c, d );
function(ar, low, mid, level - 1);
function(ar, mid, high, level - 1);
}

[/SOURCE]
[/source] This is sorta out there and I don't even have an idea of what I would to this for, just curious if this has a name to it so I can look into it. I read that recursion is often used in AI, is this true? If this is just another branch of recursion that could be understood too. Thanks to anyone who helps! PS: some of the code may be a little off, but it's just the idea of how the funtion inside of a function calls its parent.

##### Share on other sites
It is recursion and it looks a lot like a recursive divide-and-conquer approach. Maybe you like this. It is a recursive implementation of merge sort much along the lines in your example. It might help you sort this topic out.

Greetz,

Illco

Thanks!

1. 1
2. 2
3. 3
Rutin
16
4. 4
JoeJ
13
5. 5

• 10
• 9
• 14
• 10
• 25
• ### Forum Statistics

• Total Topics
632646
• Total Posts
3007637
• ### Who's Online (See full list)

There are no registered users currently online

×