Open In App

GATE | GATE-CS-2002 | Question 3

Like Article
Like
Save Article
Save
Share
Report issue
Report

The solution to the recurrence equation T(2k) = 3 T(2k-1) + 1, T (1) = 1, is:
(A) 2k
(B) (3k + 1 – 1)/2
(C) 3log2k
(D) 2log3k


Answer: (B)

Explanation: We have

T (2k) = 3  T (2k-1) + 1

= 32  T (2k-2) + 1 + 3
= 33  T (2k-3) + 1 + 3 + 9
. . . (k steps of recursion (recursion depth))
= 3k  T (2k-k) + (1 + 3 + 9 + 27 + … + 3k-1)
= 3k + ( ( 3k – 1 ) / 2 )
= ( (2 * 3k) + 3k – 1 )/2
= ( (3 * 3k) – 1 ) / 2
= (3k+1 – 1) / 2

Hence, B is the correct choice.

 

Please comment below if you find anything wrong in the above post.

Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads