aspose file tools
The moose likes Java in General and the fly likes a question in building recursion.. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "a question in building recursion.." Watch "a question in building recursion.." New topic
Author

a question in building recursion..

alex lotel
Ranch Hand

Joined: Feb 01, 2008
Posts: 191
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
??
Anand Hariharan
Rancher

Joined: Aug 22, 2006
Posts: 252

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


"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- Antoine de Saint-Exupery
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: a question in building recursion..
 
Similar Threads
Long Hexadecimal numbers
Code segment question #1
Manipulating Hex Integers
please explain
Generics question (Devaka Diagnostic Exam, Question 57)