Hi Team, Such problems like yours are usually being solved with recursion algorithms. It is very easy with recursion. If you manage to solve it with recursion in JBase please send me the algorithm written.
I’ll try to picture you the iterative algorithm. For 4 symbols you have to have 24 combinations. Right. OK, here is the logic We start with your 6 permutations without repetitions which are actually combinations. ABC ACB BCA BAC CAB CBA Let’s add one more symbol D. If you add D at the first position you have the following sequence DABC DACB DBCA DBAC DCAB DCBA If you continue to add D on the next positions, i.e. 2th ,3th and 4th you are going to produce the following combinations ADBC ADCB BDCA BDAC CDAB CDBA ABDC ACDB BCDA BADC CADB CBDA ABCD ACBD BCAD BACD CABD CBAD So you now have 24 combinations. With 5 symbols you’ll have 120 combinations. I think it is totally clear now. Can you please send me the algorithm when you’ll manage to develop it? Kind regards Igor Micev On May 8, 8:06 am, kavi <[email protected]> wrote: > Hi Team, > > Could anyone please give me the logic for the following > > 1. I have an array of values with VM seperation.The array can have any > number of values. > > Example ---- ARRAY = 'A':VM:'B':VM:'C' > > 2. If the count is 3, i want 3!(factorial) combinations to be > displayed like > > ABC > ACB > BCA > BAC > CAB > CBA > > Likewise, if the count is 4, then there should be 4! combinations (ie > 24 combinations). > > The count should be n numbers.(Generic and not a specific value.) > > I need a logic to implement this. Please help me --~--~---------~--~----~------------~-------~--~----~ Please read the posting guidelines at: http://groups.google.com/group/jBASE/web/Posting%20Guidelines IMPORTANT: Type T24: at the start of the subject line for questions specific to Globus/T24 To post, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jBASE?hl=en -~----------~----~----~----~------~----~------~--~---
