Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

Блог пользователя epsilon_delta

Автор epsilon_delta, история, 3 года назад, По-английски

Problem Link — Domino-and-tromino-tiling-problem

In this edutorial there is two problem.

part-1) Some tiling problems (I understand this completely)

part-2) A more complicated tiling problem (I have doubt in this)

the recurrence relation is f(n) = f(n-1) + f(n-2) + 2g(n-2)

I have doubt in function g(n) → (covering n*2 grid using L-shaped tile) is the recurrence reletion (g(n-2) part explain little bit) is correct.

I got some explanation for this question but i have some doubt; please Help!!!

- The **Dp formula** for this question is this dp[n]=dp[n-1]+dp[n-2]+ 2*(dp[n-3]+…+d[0])

-  according to my understanding the dp[n-1] and dp[n-2] is due to domino

- and the 2*(dp[n-3]+…+d[0]) is due to tromino

- can someone explain why the total number of tiling for the trominos is 2*(dp[n-3]+…+d[0]);

or if my understanding about Dp formula is wrong please correct me!!

please help!!!

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

The function g(n) is not covering n*2 grid using L-shaped tiles. It is for covering the n*2 grid with one extra block on either side, by using either dominos or by using L-shape, or both. Basically, g(n) uses the fact that you will have to use another L-shape somewhere, which will convert it into a normal k*2 grid somewhere during tiling.

The recurrence relation is g(n) = g(n-1) + f(n-1).
Now, keep substituting the value for g on RHS, we get something like

g(n) = (g(n-2)+f(n-2)) + f(n-1)  
g(n) = ((g(n-3) + f(n-3)) + f(n-2)) + f(n-1)
...
...
g(n) = g(0) + f(0) + f(1) + f(2) + ... + f(n-1)

Since g(0) = 0, we get g(n) = f(0) + f(1) + f(2) + ... + f(n-1), or

g(n) = sum[i=0 to n-1](f(n))

Now, f(n) = f(n-1) + f(n-2) + 2*g(n-2) Substituting value of g in the equation, we get

f(n) = f(n-1) + f(n-2) + 2*(sum[i=0 to (n-2)-1])(f(i))
     = f(n-1) + f(n-2) + 2*(sum[i=0 to n-3](f(i)))
     = f(n-1) + f(n-2) + 2*(f(0)+f(1)+f(2)+...+f(n-3))

The term 2*(dp[n-3]+…+d[0]) comes from last part of this equation.