Results 1 to 3 of 3

Math Help - Divide an conquer algorithms

  1. #1
    Newbie
    Joined
    Dec 2009
    Posts
    1

    Divide an conquer algorithms

    Find f(n) when n = 2^k, where f satisfies the recurrence relation f(n) = f(n/2) + 1 with f(1)=1.

    I'm very confused by this theory any help would be appreciated. I was using f(n)= C1*n^(logb(a)) +C2
    where C1 = f(1) + c/(a-1) and C2 = -c/(a-1)

    but a =1 im very confused
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Joined
    Oct 2009
    Posts
    5,561
    Thanks
    785
    For this problem, it is easier to look at some special cases and use common sense than to fiddle with a general formula. So write a table with three rows. The first row contains k=0,1,2,3,4,\dots, the second row lists n=2^k and the third row lists f(n)=f(2^k). Then look at how to express values in the third row in terms of the first two rows. Or the other way around. E.g., if you find that g(f(n))=n for some function g that has an inverse g^{-1}, then f(n)=g^{-1}(n).
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Senior Member
    Joined
    Nov 2009
    Posts
    277
    Thanks
    2
    You give:
    f(n) = f(n/2) + 1 with f(1)=1.

    So:
    f(1)=1
    f(2)=f(1)+1=1+1=2
    f(4)=f(2)+1=2+1=3
    f(8)=f(4)+1=3+1=4
    etc.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Algorithms
    Posted in the Math Software Forum
    Replies: 2
    Last Post: November 4th 2010, 09:25 PM
  2. Algorithms
    Posted in the Discrete Math Forum
    Replies: 2
    Last Post: October 8th 2010, 10:48 PM
  3. Algorithms
    Posted in the Discrete Math Forum
    Replies: 1
    Last Post: December 4th 2009, 04:06 AM
  4. Replies: 1
    Last Post: July 28th 2008, 09:51 PM
  5. Algorithms!
    Posted in the Discrete Math Forum
    Replies: 4
    Last Post: December 15th 2006, 04:03 AM

Search Tags


/mathhelpforum @mathhelpforum