Q2)
your answer for part b and c are correct (even I got the same)
but for part (a) i got 96
given n=6 & k=8 (Ti denotes train i, E-enter, L-leave)
first T1 enters(obviously)
now since k=8 we can have maximum of 4 more trains entering and leaving before T1 leaves
case 1:
4 trains(T2 to T5) enter and leave before T1 leaves,that is, fix the position of T1 as 5 in the output sequence:
there are 14 possible ways in which T2 to T5 occupy the first 4 positions in the output sequence(can be easily verified)
For each of these 14 ways,there is only 1 way in which T6 can occupy the sixth position(EL)
So, 14 x 1 = 14;
case 2:
3 trains(T2 to T4) enter and leave before T1 leaves,that is, fix the position of T1 as 4 in the output sequence:
there are 5 possible ways in which T2 to T4 occupy the first 3 positions in the output sequence(can be easily verified)
For each of these 5 ways,there are 2 ways in which T5 & T6 can occupy the 5th and 6th position(EELL and ELEL)
So, 5 x 2 = 10;
case 3:
2 trains(T2 , T3) enter and leave before T1 leaves,that is, fix the position of T1 as 3 in the output sequence:
there are 2 possible ways in which T2 & T3 occupy the first 2 positions in the output sequence
For each of these 2 ways,there are 5 ways in which T4 to T6 can occupy the last 3 positions.
So, 2 x 5 = 10;
case 4:
1 train(T2) enter and leave before T1 leaves,that is, fix the position of T1 as 2 in the output sequence:
there is only one possible way in which T2 occupies the first position in the output sequence
For this one way,there are 14 ways in which T3 to T6 can occupy the last 4 positions.
So, 1 x 14 = 14;
So far total output sequences generated: 14+10+10+14=48;
case 5:
zero trains enter and before T1 leaves,that is, fix the position of T1 as 1 in the output sequence:
now again we have 5 more trains(T2 to T6) which have 48 output sequences as shown above.
hence total no. of output sequences = 48x2 = 96;
ANS:96