The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+26 votes

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

  1. each is sorted in ascending order,
  2. $B$ has $5$ and $C$ has $3$ elements, and
  3. the result of merging $B$ and $C$ gives $A$
  1. $2$
  2. $30$
  3. $56$
  4. $256$
asked in Combinatory by Veteran (52k points)
edited by | 3.3k views

3 Answers

+31 votes
Best answer
If you pick any $3$ numbers in the given order from the array(sorted) remaining $5$ elements are already sorted. You can not change the relative position of those $5$ elements because they are distinct and already sorted. So no of ways $= {}^8C_3.$

Same argument holds for picking up $5$ elements initially. No of ways $= {}^8C_5.$

Correct Answer: $C$
answered by Veteran (56.4k points)
edited by
Thanks @ Debashish Deka

 here the question asks only for selection and not for an arrangement of the selected nos. This is where I got confused. pick 3 or 5 elements, remaining elements will remain sorted since all are distinct nos.
+31 votes

answer - C

select any $3$ elements from given $8$ elements - $^8C_3$

answered by Loyal (8.7k points)
edited by
Let the sequence be

1 2 3 4 5 6 7 8 (=A)

if i select any  3 elements say 3,4,5 (=C) then B would be 1,2,6,7,8

On merging B and C i get 1,2,6,7,8,3,4,5 which is not in ascending order as A..

Can you please explain the case as here i am not getting A on merging....
You didn't merge. You just appended. Merging is a process - the same one used in merge sort.

8C= 8C3 
picking 3 elemts and picking 5 elements  means same thing , rt ?


why its not 8C3+ 8C5

as we have two way to do it

1) Pick element for B first then C = 8C5 * 3C3= 8C5

2)Pick element for C first then B = 8C3 * 5C5= 8C3

+12 votes
The question actually is based on combinations not merging.Firstl y two arrays are taken : B having 3 elements and C having 5 elements sorted in ascending order and then merged into a single array A having 8 elements.We have to find no of distinct sequences. 8 elements can be arranged in 8! ways out of that 3 elements of array B can be arranged in 3! ways and 5 elements of C can be arranged in 5! ways. Now, No. of distinct sequences = 8!/3! 5! = 56 Ans.
answered by (409 points)

@arjun sir "We have to find no of distinct sequences. "

could u plz explain this ?what does it mean

C(8,5)  produces distinct sequences

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
49,541 questions
54,084 answers
70,992 users