# Algorithms | Recurrences | Set 1

**Question 1:**Which of the following is the value of T^{3}(n) where T^{3}(n) is defined as T^{3}(n) = 5*T^{3}(n-1) – 4*T^{3}(n-2)- C
_{1}*5^{n}+ C_{2}*4^{n} - C
_{1}+ C_{2}*4^{n} - C
_{1}*2^{n}+ C_{2}*4^{n} - C
_{1}*5^{n}+ C_{2}*(-4)^{n}

**Answer:**2**Explanation:**The recursion function (equation) seems to have a strange form. Let’s change the variable T^{2}(n) to get an equation of a familiar form; so, we let A(n) = T^{3}(n); then we have:The characteristic equation of our new differential equation would be:

So, the homogeneous solution to this equation shall be:

As we have defined A(n) = T

^{3}(n), the final answer is:- C
**Question 2:**Determine the value of initial condition F(1) in a way that we can have F(n) = (n+2)! as the solution to the following given recursive function:**F(n) = (n+1) * F(n-1) + (n+1)!**- 3
- 4
- 6
- 2

**Answer:**3**Explanation:**Through using the iteration technique to solve the given recursive function, we’ll have:If we continue these derivations, we can easily guess that the answer should be of following form:

The last step (stop point) in iteration method is when we reach the initial condition F(1); therefore, we let k = n-1, and the non-recursive form would be:

In according to the given function F(n) in question, and what we have derived till now:

Finally, as we shall see, the value of F(1) is:

**Question 3:**What is the time Complexity of T(n) = 4* T(n/2) + n * log(n!).- θ(n * log n)
- θ(n
^{2}) - θ(n
^{2}* log n) - θ(n
^{2}* log^{2}n)

**Answer:**4**Explanation:**We know that**log(n!) ∈ θ( n * log n )**.

Now, the equivalent problem is to analyze the order of the new recursive function:

We can solve this by master theorem. In order to apply master theorem here, we have

**f(n) = n**, and the parameters^{2}* log(n)**a**(the number of sub-problems),**b**(the reduction factor), and**C**equal to 4, 2, and 2, respectively; so, θ( n^{logba}), is of θ( n^{2}) which lies in the same complexity class of θ( n^{C = 2}); therefore, the given recursive function is belong to the case 2 of master theorem.In according to master theorem, T(n) would be of following order:

**Question 4:**Which one gives the best estimation of T(n) complexity?T (n) = * T(n/2)+ n

^{2}√n+1.- θ( n
^{2}* √n * log n ) - O( n
^{2}* √n+1 * log n ) - θ( )
- θ( )
- O( n
^{2}* √n ).

**Answer:**3**Explanation:**We know that , and ; so, we can simplify the recursion function as following:It belongs to the case 3 of the

**master theorem**; so, the asymptotic complexity of**T(n)**is:

- θ( n
**Question 5:**Which asymptotic boundary is not correct for T (n) = T (n/4) + T (3n/4) + n ?- O( n
^{log4/3 2}) - Ω( n )
- O( n * log(n) )
- None of above

**Answer:**4**Explanation:**By**master theorem**, we can specify the same boundaries as indicated in first two options (A) and (B):We can find out the correctness of third option by the

**recurrence tree**method. We draw a tree and we can easily guess an appropriate boundary for**T(n)**:The length of the branches of the recurrence tree cannot be less than

**h**, and neither can be more than_{r}**h**; so the following estimations can be inferred:_{L}In according to the two boundaries mentioned above, we also have

**T(n) ∈ θ( n*log(n) )**.We know that if

**T(n) ∈ O(n * log(n))**, it must be also of**O(n**; so if we have evaluated the third option first, we actually would have inferred the correctness of option (A) too. However, recurrence trees just give idea on how to guess an appropriate boundary. As someone may give a wrong guess, this method also needs verification or proof that it will not violate the definition of the notations in use. This verification (proof) can be obtained inductively by iterative substitutions into T(n), while considering the notation definitions.^{log4/3n})- O( n

## Recommended Posts:

- Analysis of Algorithm | Set 4 (Solving Recurrences)
- Master Theorem For Subtract and Conquer Recurrences
- Advanced master theorem for divide and conquer recurrences
- Introduction to Algorithms
- Pseudo-polynomial Algorithms
- Analysis of Algorithms | Set 3 (Asymptotic Notations)
- Analysis of Algorithms | Set 5 (Practice Problems)
- Analysis of algorithms | little o and little omega notations
- Asymptotic Analysis and comparison of sorting algorithms
- How can one become good at Data structures and Algorithms easily?
- Interesting Examples of algorithms in everyday life
- Mutation Algorithms for Real-Valued Parameters (GA)
- Analysis of Algorithms | Set 2 (Worst, Average and Best Cases)
- Loop Invariant Condition with Examples of Sorting Algorithms
- Difference between Deterministic and Non-deterministic Algorithms

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.