The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+21 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 (59.5k points)
edited by | 2.4k views

3 Answers

+23 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.$
answered by Veteran (56.9k points)
selected 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 (9k 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 (437 points)

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

37,939 questions
45,453 answers
48,209 users