Let A be a sequence of 8 distinct integers sorted in ascending order. How many distinct pairs of sequences, B and C are there such that (i) each is sorted in ascending order, (ii) B has 5 and C has 3 elements, and (iii) the result of merging B and C gives A?
Suppose you have selected 3 elements from 8 in 8C3 ways, the remaining elements are treated as another array and merging both the arrays gives the sorted array. Here, you can select either 3 or 5.
=> 8C3 = 8C5 = 8!/(3!5!) = 7*8 = 56 Ways.
This solution is contributed by Anil Saikrishna Devarasetty
Quiz of this Question
Attention reader! Don’t stop learning now. Learn all GATE CS concepts with Free Live Classes on our youtube channel.