GATE Computer ScienceHardGATE CS (PYQ pattern)
T(0) = T(1) = 1 and T(n) = T(n − 1) + T(n − 2) + n for n ≥ 2. What is T(12)?
- A. 1076
- B. 1046
- C. 655
- D. 1061
Correct answer: D. 1061
Try a particular solution an + b: an + b = a(n−1) + b + a(n−2) + b + n gives a = −1, b = −3. So U(n) = T(n) + n + 3 satisfies U(n) = U(n−1) + U(n−2) with U(0) = 4, U(1) = 5: 4, 5, 9, 14, 23, 37, 60, 97, 157, 254, 411, 665, 1076. T(12) = 1076 − 15 = 1061.
More Discrete Mathematics questions
- In how many ways can 16 be written as an ordered sum (a composition) of parts each equal to 1, 3 or 4?
- How many ordered 5-tuples of positive odd integers, each at most 9, sum to 25?
- Eight people A, B, C, D, E, F, G, H sit around a round table (arrangements that differ by rotation are the same). In how many arrangements…
- How many permutations of {1, …, 6} have no increasing subsequence of length 4 and no decreasing subsequence of length 3?
- How many relations on {1, 2, 3} are reflexive and transitive (preorders) but are neither symmetric nor antisymmetric?
- A tree has 3 vertices of degree 4, 2 vertices of degree 3 and every other vertex is a leaf (degree 1). How many vertices does the tree have?