TL DR: I believe that recurrence is n O (log n) which is superpolynomial, but subexponential. I do not have a corresponding lower bound, and I doubt that it is dense, but it is progressing!
I think I can get an upper bound, sub-exponential, but super-polynomial. Combined with @Adam Rosenfield's answer, which shows that there is no polynomial border, it shows that
- A recurrent does not have a polynomial boundary, but
- Any exponential boundary must be weak.
The repetition we want to solve
T (n) = T (n - 2) + T (n / 2) + 1
T (1) = T (2) = 1
One of my ideas was that we could evaluate this repetition in a certain order. Suppose you want to evaluate T (n). Doing this for one step gives
T (n - 2) + T (n / 2) + 1
Now suppose we expand the term T (n - 2). This gives
T (n - 4) + T (n / 2 - 1) + T (n / 2) + 2
Now expand the n-4 term. Doing this gives
T (n - 6) + T (n / 2 - 2) + T (n / 2 - 1) + T (n / 2) + 3
We can repeat the process of decomposition of the subtractive term (the term of the form T (n - 2k)) again and again. So what happens if we decompose it to the point where n - 2k is about n / 2? This will happen about 4 times. If we do this, we get that
T (n) = T (n / 2) + T (n / 2) + T (n / 2 - 1) + T (n / 2 - 2) + ... + T (n / 2 - n / 4 ) + n / 4
I will make the assumption that T (n) is non-decreasing. If we do this, we get that
T (n)? T (n / 2) + T (n / 2) + T (n / 2) + ... + T (n / 2) + n / 4
T (n)? (n / 4 + 1) T (n / 2) + n / 4
I will be a little rough with the math here and make another simplification: instead of having the coefficient T (n / 2) be (n / 4 + 1), I will just have it n / 4. I know that this is unsafe, but I am going to assume that this is not too much connected with the result. It would be nice to double check that everything else still works after that though!
This means that we can simplify our higher repeatability (roughly) to get that
T (n)? (n / 4) T (n / 2) + n / 4
This is much easier to work with, and now we can try to solve it directly. We will use the iteration method and just continue to connect it to ourselves again and again until we see the template. If we do this, we will see the following pattern:
T (n)? (n / 4) T (n / 2) + n / 4
& le; (n / 4) ((n / 8) T (n / 4) + n / 8) + n / 4
= (n 2/32) T (n / 4) + n / 4 + n 2/32
& le; (n 2/32) ((n / 16) T (n / 8) + n / 16) + n / 4 + n 2/32
= (n 3/512) T (n / 8) + n / 4 + n 2/32 + n 3/512
& le; (n 3/512) ((n / 32) T (n / 16) + n / 32) + n / 4 + n 2/32 + n 3/512
= (n 4/16384) T (n / 16) + n / 4 + n 2/32 + n 3/512 + n 4/16384
Let's look at the template that appears. After that k times, the coefficient T (n / 2 k ) is equal to n k divided by some power of two. So far, these two forces have been 4, 32, 512, 16384. These figures do not have any obvious pattern for them, but if we rewrite them as 2 2 2 5 2 9 2 14 we see that they follow the pattern 0, 2, 5, 9, 14, .... This is less than the triangular numbers 1, 3, 6, 10, 15, .... This is not a coincidence: if you think about it, the denominator continues to be multiplied by the next power of two times when we expand the repetition, which increases the exponents in powers of two from one triangular number to another. Therefore, we expect that the denominator after k-iterations will be given
2 (k + 1) (k + 2) / 2 - 1
After that, the remaining terms are the sum of powers of n divided by the degrees of two raised to different triangular numbers. Therefore, if we decompose things from k times, we get
T (n)? (k + 2) / 2 - 1) T (n / 2 k ) + & Sigma, i = 0 k (n i / 2 (i + 1) (i + 2) / 2 - 1 )
Good! So itβs a mess, but itβs not so bad. We know that recursion stops as soon as n / 2 k = 1, which happens when k = log n. To make things a little easier, I'm going to change the base case so that the recursion stops when n / 2 k = 2, which happens when k = log n - 1. It does not change anything more than a constant factor. So, if we substitute in k = log n - 1 in the above formula, we can simplify to get an expression with a closed form for the upper boundary. Doing this gives the following:
T (n)? (k + 2) / 2 - 1) T (n / 2 k ) + & Sigma, i = 0 k (n i / 2 (i + 1) (i + 2) / 2 - 1 )
= (n log n - 1/2 (log n) (log n + 1) / 2 - 1 ) T (2) + & Sigma; i = 0 lg n - 1 (n i / 2 (i + 1) (i + 2) / 2 - 1 )
Ohhh, this is ugly. However, this is not as bad as it might seem. Let's look at the denominator of the first term:
2 (log n) (log n + 1) / 2 - 1
Using the basic laws of indicators, we get that
2 (log n) (log n + 1) / 2 - 1
= (2 log n ) (log n + 1) / 2 - 1
= n (log n + 1) / 2 - 1
It's not so bad! Therefore, if we take the expression
n lg n - 1/2 (lg n) (lg n + 1) / 2 - 1
We see that it is simplified as follows:
n lg n - 1/2 (lg n) (lg n + 1) / 2 - 1
= n log n - 1 / n (log n + 1) / 2 - 1
= n (log n - 1 - ((log n + 1) / 2 - 1))
= n (log n - (log n + 1) / 2)
= n (2 log n - log n - 1) / 2)
= n (log n - 1) / 2)
= n O (log n)
Sharpness! This leading term ends with the form n O (log n) !
What about the rest? Well, we have this terrible summation to deal with:
& Sigma; i = 0 lg n - 1 (n i / 2 (i + 1) (i + 2) / 2 - 1 )
Fortunately, you can see that
n i / 2 (i + 1) (i + 2) / 2 - 1
& le; n i / 2 (i + 1) (i + 2)
& le; n i / 2 (i + 1)
& le; n i / 2 i
= (n / 2) i
So, if all we want to do is the upper bound of the summation, we can do it using this much simpler sum:
& Sigma; i = 0 log n - 1 (n / 2) i
Since n / 2> 0, this sum, in turn, the upper bound is bounded
& Sigma; i = 0 log n - 1 (n / 2) log n - 1
= (log n) (n log n - 1 ) / (2 log n - 1 )
= (2 log n) (n log n - 1 ) / n
= (2 log n) n log n - 2
= n O (log n)
And bingo, the second term in this terrible amount is also n O (lg n) ! This means that we have T (n) = n O (log n) . This estimate is not necessarily tough, but it shows that recurrence is definitely sub-exponential since n O (log n) grows more slowly than any exponential function !
Hope this helps!