Using recursive divide and conquer algorithm

Feb 19, 2013 at 3:37am
I am having trouble getting started on a data structures book problem. I have to recursively divide an array down to base case 4. I am not really sure how to recursively call the function and divide the array by four each time. Can someone explain it a little bit for me?
Feb 19, 2013 at 5:52am
What did you mean by "divide array by four"? Divide each element in arry by four? Or something else?

To recuresively call function you should call it within itself:
1
2
3
4
5
6
void function()
{
//...
    function();
//...
}

It is a good idea to include some sort of condition to stop recursion, if you don't want recursion to run indefinetly
Topic archived. No new replies allowed.