GATE CSE
First time here? Checkout the FAQ!
x
+6 votes
207 views
  • Using numbers from  S = $\left \{ 1,2,3,4.......n \right \}$
  • We can use maximum up to m numbers to form a set using numbers from S. Repetition of numbers allowed.
  • How many ways we can form a set such that,  $\sum x_i = K$.  Where $K$ is another positive integer. Where $x_i$ are the elements belong $S$ that are included in the newly formed set.

For example :

  • S = $\left \{ 1,2,3,4,5...11,12 \right \}$
  •  m = $4$
  • if $K = 6$
  • Then possible few possible sets are $\{2,4\}, \;\; \{1,3,2\}, \;\; \{1,4,1\},\;\; \{1,1,1,3\}$ etc.
  • $\{1,1,1,1,2\}$ is not valid set for example.
  • Now how many such sets for a particular instance of the problem ? with 
  • S = $\left \{ 1,2,3,4,5,6...12 \right \}$ , $m = 5$, $K = 8$ ?
  • If there is any generic idea ?
  • Ordered / Unordered both the cases !
asked in Combinatory by Veteran (56.9k points) 36 194 500
retagged by | 207 views
Do we have to count {1,2,3} and {1,3,2} different ?
no need to count ..updated !
After a little bit of work around I ended up with 16 as the answer to this specific question. Let me know if that is right, I will then share my approach.

Ii don't know share your approach!

Actually, I need the ordered collection only ..sorry for describing the QS as an unordered set. @kapil asked earlier about this.


will this recurrence work ? for ordered collection?

f(m,k) = no of ordered collection using the numbers from S

$f(m,k) = \begin{cases} 1 \qquad m=0 , k = 0\\ \\ 0 \qquad m=0 , k > 0\\ \\ \sum_{x_i \; }^{\{\{0\} \cup S \}\;} f(m-1,k-x_i) \quad m \geq 1 , (k+x_i) \geq 0 \\ \end{cases}$

@Debashish we can solve using generating functions .

$G(x)=(x+x^{2}+x^{3}+...+x^{m})^{n}$

which is infinite series. The number of such sets would be of coefficient $x^{k}$.

1 Answer

0 votes
in my openion no of subset possible with a given set is countable ,

 

approach is we have to enumarate it by some another way

first take 0 length subset which is 1

then take 1 lenth subset which is n

then take 2 lenth subset and count all the two length subset passoibel

similarly we can enumarate them so , its countable
answered by Loyal (4.4k points) 6 39 85


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
Top Users Oct 2017
  1. Arjun

    23684 Points

  2. Bikram

    17288 Points

  3. Habibkhan

    9192 Points

  4. srestha

    6486 Points

  5. Debashish Deka

    5478 Points

  6. jothee

    5148 Points

  7. Sachin Mittal 1

    4910 Points

  8. joshi_nitish

    4492 Points

  9. sushmita

    4078 Points

  10. Rishi yadav

    3998 Points


Recent Badges

100 Club chetan raghav
Nice Answer bhupalreddy
Medalist bhupalreddy
Old-Timer Kushal06
Notable Question akankshadewangan24
Good Question the.brahmin.guy
Good Answer Arjun
Revival Arjun
Nice Comment Arjun
Verified Human gunjan79
27,423 questions
35,273 answers
84,588 comments
33,511 users