GATE / CS ARCHIVE

GATE CSE 2014 SET 1 / QUESTION 49

GATE CSE 2014 Set 1 Q49

Discrete Mathematics · Recurrences & Generating Functions · Full GATE CSE 2014 Set 1 paper

GATE 2014 Set 1, Q49 2 marks · NAT
Report issue

Recurrences & Generating Functions

Question 49, GATE 2014: An n-pennant is an ordered sequence of 1s and 2s whose sum is n. For example (1,1,2) is a 4-pennant, and (1,2) differs from (2,1). There is one 1-pennant and two 2-pennants. How many 10-pennants exist?
Tap to enlarge
Answer & solution

Official answer: 88.9 to 89.1

Our answer: 89

1. Method and setup. Partition all sequences by their first symbol. Removing a leading 1 leaves an (n−1)-pennant; removing a leading 2 leaves an (n−2)-pennant. These classes are disjoint and exhaustive, yielding a Fibonacci-type recurrence without double counting different orders.

2. Work through the result and its assumptions. Let a 0=1 count the empty sequence and a 1=1. Partition sequences by their first entry 1 or 2: an=a(n−1)+a(n−2). The values through n=10 are 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89. Thus there are 89 ten-pennants, inside the published interval.

Original paper, page 20 · Answer key