How Many Recursions Does T(n) Need for k?

  • Thread starter flying2000
  • Start date
In summary, the conversation discusses finding the number of recursions needed for T(n) to reach a certain value k. It is suggested to use a continuous function such as dy/dx = sqrt(y) with y(0)=1 to bound T(n) and show that it is bigger than T(n). The constant c=2 is determined as a good bound for this function.
  • #1
flying2000
40
0
Suppoese

T(0) = 1
T(n) = T(n-1) + root(T(n-1))

how many recursion does T(n) need to grow to the number k?
can I get this? root(k) < m < c root(k)
c is constant and m is the times we need for T(n) goes to k.

Any help appreciated!
 
Last edited:
Mathematics news on Phys.org
  • #2
You can bound it with a continuous function.

Try solving dy/dx = sqrt(y) with y(0)=1, you can show that this function is bigger than T but gives a pretty good bound. Solving the above gives c=2 as the constant you're looking for.

BTW: Maybe I'm just dumb but I had to read you post about three times before I figured out that by "root" you meant square root or sqrt or [tex]\sqrt(.)[/tex].
 
Last edited:
  • #3


The number of recursions needed for T(n) to reach the number k depends on the value of k and the function T(n) itself. The given recurrence relation suggests that T(n) is growing at a rate of the square root of the previous term. This means that the number of recursions needed will increase as the value of k increases.

To determine the exact number of recursions needed, we need to solve the recurrence relation T(n) = T(n-1) + root(T(n-1)) and find the value of T(n) that equals k. This will give us the number of recursions needed to reach k.

However, if we assume that the value of k is very large, we can make an approximation by using the formula root(k) < m < c root(k) where c is a constant and m is the number of times needed for T(n) to reach k. This means that the number of recursions needed will be between root(k) and c root(k).

In conclusion, the exact number of recursions needed for T(n) to reach k cannot be determined without solving the recurrence relation. However, we can make an approximation by using the formula root(k) < m < c root(k) where c is a constant and m is the number of times needed for T(n) to reach k.
 

FAQ: How Many Recursions Does T(n) Need for k?

How is the number of recursions for T(n) determined?

The number of recursions for T(n) is determined by the input size, n, and the complexity of the algorithm. It is typically calculated by analyzing the recurrence relation for T(n) and solving for the number of steps or recursive calls needed to reach the base case.

Can the number of recursions for T(n) vary for different inputs?

Yes, the number of recursions for T(n) can vary for different inputs since it is dependent on the input size and algorithm complexity. In some cases, a smaller input may require fewer recursions while a larger input may require more.

Is there an optimal number of recursions for T(n)?

There is no one optimal number of recursions for T(n) as it depends on the specific algorithm and its efficiency. However, in general, fewer recursions are preferred as they can improve the overall runtime of the algorithm.

How can the number of recursions for T(n) be optimized?

The number of recursions for T(n) can be optimized by improving the efficiency of the algorithm. This can be achieved through various methods such as using dynamic programming, memoization, or implementing a more efficient algorithm altogether.

Can the number of recursions for T(n) be determined before running the algorithm?

In most cases, the number of recursions for T(n) cannot be determined before running the algorithm. It is usually calculated during the analysis of the algorithm and may vary depending on the input size. However, for simpler algorithms, it may be possible to manually determine the number of recursions by tracing the recursive calls.

Similar threads

Replies
14
Views
2K
Replies
5
Views
1K
Replies
4
Views
3K
Replies
1
Views
764
Replies
2
Views
1K
Replies
8
Views
2K
Replies
2
Views
2K
Replies
6
Views
2K
Back
Top