Thread: Recursion

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    110
    Quote Originally Posted by MacNilly View Post
    ...The obvious choice here is when there are no more values in the array to compare....

    Then, for the base case, inside the function:
    Code:
    if (size == 1)
        return MAX(cur_max, array[0]);
    Err, I think you mean the obvious choice is when there is one element in the array:

    Code:
    if ( size == 1 ) 
        return array[0];
    since that value *has* to be the max.

  2. #2
    Registered User
    Join Date
    Jul 2008
    Posts
    80
    Im getting the idea, but how do u split an array in half?
    Code:
      like array[]={1,2,3,4}  to  array[]={1.2} and array[]={3,4]  ?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Template Recursion Pickle
    By SevenThunders in forum C++ Programming
    Replies: 20
    Last Post: 02-05-2009, 09:45 PM
  2. Recursion... why?
    By swgh in forum C++ Programming
    Replies: 4
    Last Post: 06-09-2008, 09:37 AM
  3. a simple recursion question
    By tetra in forum C++ Programming
    Replies: 6
    Last Post: 10-27-2002, 10:56 AM
  4. To Recur(sion) or to Iterate?That is the question
    By jasrajva in forum C Programming
    Replies: 4
    Last Post: 11-07-2001, 09:24 AM
  5. selection sorting using going-down and going-up recursion
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-02-2001, 02:29 PM