1

I came across this problem, Tiling with Dominoes and initially I faced difficulty in understanding the logic behind recurrence relation, but after reading it from here , I understood it. But I had a doubt, why aren't we considering the below cases for the above problem?

In the solution only these cases are mentioned,

********   AA*******   AA******   A*******
******** = BB******* + B******* + A*******
********   CC*******   B*******   BB******
  f(n)   =  f(n-2)   +  g(n-1)  +  g(n-1)

But my question is there can be other case as well, like below, why aren't we adding them, because the problem asks for the number of possible cases-

********   AA*******   AA******   A*******   AB******   CC******
******** = BB******* + B******* + A******* + AB****** + AB******
********   CC*******   B*******   BB******   CC******   AB******
  f(n)   =  f(n-2)   +  g(n-1)  +  g(n-1)  +   f(n-2) +  f(n-2)

Why aren't we adding them? Thanks for your help.

1 Answers1

2

These two cases are already counted in the recursive calls g(n-1).

A****
A****
BB***
g(n-1)

g(n-1) counts all possibilities to fill the empty space in this ^ form. One way would be to fill it out like the following image, so this case already gets counted and you don't need to add another recursive call.

AC***
AC***
BB***
Jakube
  • 1,605
  • 10
  • 14