Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9155623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:37:43+00:00 2026-06-17T12:37:43+00:00

I am refreshing on Master Theorem a bit and I am trying to figure

  • 0

I am refreshing on Master Theorem a bit and I am trying to figure out the running time of an algorithm that solves a problem of size n by recursively solving 2 subproblems of size n-1 and combine solutions in constant time.
So the formula is:
T(N) = 2T(N - 1) + O(1)
But I am not sure how can I formulate the condition of master theorem.
I mean we don’t have T(N/b) so is b of the Master Theorem formula in this case b=N/(N-1)?
If yes since obviously a > b^k since k=0 and is O(N^z) where z=log2 with base of (N/N-1) how can I make sense out of this? Assuming I am right so far?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:37:44+00:00Added an answer on June 17, 2026 at 12:37 pm

    ah, enough with the hints. the solution is actually quite simple. z-transform both sides, group the terms, and then inverse z transform to get the solution.

    first, look at the problem as

        x[n] = a x[n-1] + c
    

    apply z transform to both sides (there are some technicalities with respect to the ROC, but let’s ignore that for now)

        X(z) = (a X(z) / z) + (c z / (z-1))
    

    solve for X(z) to get

        X(z) = c z^2 / [(z - 1) * (z-a)]
    

    now observe that this formula can be re-written as:

        X(z) = r z / (z-1) + s z / (z-a)
    

    where r = c/(1-a) and s = – a c / (1-a)

    Furthermore, observe that

        X(z) = P(z) + Q(z)
    

    where P(z) = r z / (z-1) = r / (1 – (1/z)), and Q(z) = s z / (z-a) = s / (1 – a (1/z))

    apply inverse z-transform to get that:

        p[n] = r u[n] 
    

    and

        q[n] = s exp(log(a)n) u[n]
    

    where log denotes the natural log and u[n] is the unit (Heaviside) step function (i.e. u[n]=1 for n>=0 and u[n]=0 for n<0).

    Finally, by linearity of z-transform:

        x[n] = (r + s exp(log(a) n))u[n]
    

    where r and s are as defined above.

    so relabeling back to your original problem,

        T(n) = a T(n-1) + c
    

    then

        T(n) = (c/(a-1))(-1+a exp(log(a) n))u[n]
    

    where exp(x) = e^x, log(x) is the natural log of x, and u[n] is the unit step function.

    What does this tell you?

    Unless I made a mistake, T grows exponentially with n. This is effectively an exponentially increasing function under the reasonable assumption that a > 1. The exponent is govern by a (more specifically, the natural log of a).

    One more simplification, note that exp(log(a) n) = exp(log(a))^n = a^n:

        T(n) = (c/(a-1))(-1+a^(n+1))u[n]
    

    so O(a^n) in big O notation.

    And now here is the easy way:

    put T(0) = 1

        T(n) = a T(n-1) + c
    
        T(1) = a * T(0) + c = a + c
        T(2) = a * T(1) + c = a*a + a * c + c
        T(3) = a * T(2) + c = a*a*a + a * a * c + a * c + c
        ....
    

    note that this creates a pattern. specifically:

        T(n) = sum(a^j c^(n-j), j=0,...,n)
    

    put c = 1 gives

        T(n) = sum(a^j, j=0,...,n)
    

    this is geometric series, which evaluates to:

        T(n) = (1-a^(n+1))/(1-a)
             = (1/(1-a)) - (1/(1-a)) a^n
             = (1/(a-1))(-1 + a^(n+1))
    

    for n>=0.

    Note that this formula is the same as given above for c=1 using the z-transform method. Again, O(a^n).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 5.0 MySQL servers running in Master-Master replication and before refreshing the
I have a problem refreshing a ListView. I call my ListView Activity , I
I have an excel file which is refreshing data every few seconds and running
I'm using EJB3 and I have a problem related to refreshing my EntityManager .
every time i am refreshing the page and i am getting the same value
I am refreshing cpp after a long gap, trying to understand the operator overloading
IE 8 is not refreshing a popup window that shows an image with some
I'm refreshing my Spring knowledge, reading the reference documentation for spring 3.1. Last time
I'm currently reloading (refreshing if you prefer that word more) my pages every 5
Having some trouble refreshing the image, i have a script running in the background

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.