Can I use Master Theorem if the partitions are not fractions?

In summary, if a recurrence expression recurs on partitions of size n - 1, it is not possible to use the Master Theorem. Instead, the recursion tree method can be used to determine the complexity, which in this case would be exponential with a closed form expression of 2^n. However, the value of C(0) would affect the exact complexity.
  • #1
zeion
466
1

Homework Statement



If I had a recurrence expression that recurs on partitions of size n - 1 each time, (as opposed some fraction of the original size ie. n/2), how can I apply the Master Theorem? I don't know what the "b" value is?


Homework Equations





The Attempt at a Solution



ie. If I had 2 C(n-1) + f(n), what is b?
 
Physics news on Phys.org
  • #2
You can not use the Master Theorem in this case, just use the recursion tree method. In this case it is easy to see that it will be exponential, since each level has twice the number of nodes of the previous level.
 
  • #3
Max.Planck said:
You can not use the Master Theorem in this case, just use the recursion tree method. In this case it is easy to see that it will be exponential, since each level has twice the number of nodes of the previous level.

I'm not sure what a recursion tree method is..
I see that each recursion will have twice the calls to the function as the last, but they are also on one less element than the last, does that matter?

Actually nevermind, so if I find a closed form expression it will be 2^n, right?
 
  • #4
zeion said:
Actually nevermind, so if I find a closed form expression it will be 2^n, right?

Depends on C(0) and f(n). The recursion tree method should be described in your textbook.
 
  • #5
Oh I see. It says that f(n) is constant. But it doesn't say what C(0) is.
 

FAQ: Can I use Master Theorem if the partitions are not fractions?

1. Can I use Master Theorem if the partitions are not fractions?

Yes, Master Theorem can be used even if the partitions are not fractions. The theorem applies to any function that can be written in the form T(n) = aT(n/b) + f(n), where a ≥ 1, b > 1, and f(n) is a positive function.

2. What are the main conditions for using Master Theorem?

The main conditions for using Master Theorem are that the function must be in the form T(n) = aT(n/b) + f(n), where a ≥ 1, b > 1, and f(n) is a positive function. Additionally, the function must have a logarithmic term in the recurrence relation.

3. Can Master Theorem be used for all types of algorithms?

No, Master Theorem is specifically used for analyzing divide and conquer algorithms that have a logarithmic term in their recurrence relation. It cannot be used for other types of algorithms such as linear or exponential algorithms.

4. What are the advantages of using Master Theorem?

The main advantage of using Master Theorem is that it provides a quick and easy way to determine the time complexity of a divide and conquer algorithm. It also provides a framework for understanding the time complexity of such algorithms and can help in making algorithm design decisions.

5. Are there any limitations to using Master Theorem?

Yes, there are some limitations to using Master Theorem. It can only be used for divide and conquer algorithms with a specific form and cannot be applied to other types of algorithms. Additionally, it may not always provide the most accurate time complexity analysis and may need to be supplemented with other analysis techniques.

Similar threads

Replies
2
Views
943
Replies
1
Views
2K
Replies
9
Views
2K
Replies
1
Views
1K
Replies
8
Views
1K
Back
Top