after we get f(n-4) , we can arrange the last 4 tiles horizontally as well as vertically. So, there must be a total contribution of f(n-4) + 1 from the case of f(n-4)
About n-4 case in tiling problem
https://drive.google.com/file/d/145AxHBgqqGXBUUn65hY_7BNu3geUgbRe/view?usp=sharing
i have explained the problem with a pink pen in the image
@bhavyarocks19 the question is concerned about the total no of ways of arrangement of brick this is not like that f(n-4)+1
case 1 if we place tile like vertically then left part is f(n-1) this is first way if you fill all tiles vertically.
case 2 if we place tile like horizontally then left par is f(n-4) this is second way if you fill tiles horizontally.
the total no of ways which is summation of vertical ways + horizontal ways so recurrence relation is nothing but f(n)=f(n-1)+f(n-4) if any queries come feel free to ask
in f(n-4) case , we are just putting last 4 tiles vertically,
in f(n-1) case , we are just putting only last tile vertically and not caring of what pattern is there before that last tile , as it may also be horizontal placing of bricks before last tile.
@bhavyarocks19 you don’t think like this way think recursively based on size left to allocate tile recursion will do there work
eq if n==5
1 way f(n-1)
you can either solve it with one 1 vertical tile and one horizontal tile or take all vertical tile this can be a way
2
if f(n-4)
then in this only one vertical tile or one horizontal tile will be placed
so all way will be calculate by recursion by summation of both these two
Hey Bhavya,
As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.
Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.