• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

a question in building recursion..

 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i got this question that i dond have any clue
what they want from me
it says:

build a method that takes two integer numbers
n>k>1
the method prints out all the subgroops
if the size of k
for example
subs(4,2)
prints
12,41,13,32,42,34

i cant find out was it the legality in these groops
because it meeses 22 31
??
 
Rancher
Posts: 280
VI Editor C++ Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the forum.

It appears that they are looking for the number of ways you can select 'k' elements from 'n' elements (without considering arrangement). This is called COMBINATION (if arrangment is considered, it is called PERMUTATION).

In your example, '22' is disallowed because once '2' is picked from {1,2,3,4}, it cannot be selected again. Since we disregard arrangement, '31' is the same as '13', and '13' is a part of your "subgroup".

Am not sure if "subgroup" is a right terminology here, but I guess it depends upon the curriculum.

- Anand
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic