GATE Computer ScienceVery hardGATE CS (PYQ pattern)
In how many ways can a 2 × 10 rectangle be tiled with 2 × 1 dominoes (either orientation) and 2 × 2 squares?
- A. 512
- B. 1024
- C. 89
- D. 683
Correct answer: D. 683
Let t(n) be the number of tilings of a 2 × n strip. The last column is covered by a vertical domino (t(n − 1)), or the last two columns by two horizontal dominoes or one square (2·t(n − 2)): t(n) = t(n − 1) + 2t(n − 2). From t(0) = t(1) = 1 this gives t(10) = 683.
More Algorithms questions
- How many permutations of 7 distinct items have every cycle of length at least 3 (no fixed points and no 2-cycles)?
- Twelve symbols, all with the same frequency 1, are encoded with an optimal Huffman code. What is the total number of bits to encode one…
- In the hiring problem 10 candidates arrive in uniformly random order. The first 3 are only interviewed (never hired); from candidate 4 on…
- Karger's contraction algorithm is run on a connected multigraph with n = 8 vertices, but it stops when 4 super-vertices remain (instead of…
- Which of the following statements is/are correct? I. For metric TSP, doubling an MST and shortcutting gives a 2-approximation. II…
- A = [2, 5, 9, 14, 20, 27, 35, 41] and B = [1, 6, 8, 15, 22, 30, 33, 45, 50] are sorted. What is the 10th smallest element of the union of…