Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I am having a problem dealing with following topic:

lets say we have set of numbers n = [ 1 2 2 3 ] and we want be able to get all two-elementary combinations out of that(1.) and remove all repetitions(2.).

1.) Using combination formula n!/(k! (n - k)!) we end up having 6 pairs

([1 2], [1 2], [1 3], [2 2], [2 3], [2 3])

2.) Now I do not know how to compute amount of repetitions I need to get rid of ([1 2], [2 3]) to get clean set of 4 elements ([1 2], [1 3], [2 2], [2 3]).

Can someone explain me how to deal with these problems, please? I need to learn how algorithm works so I can create different size of subgroups from elements that may repeat.

P.S. it is important to result with a set of unique subgroups, not a quantity of them.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

First count/enumerate all unordered pairs of different elements. That requires just knowing how many different elements that are in your original set.

Then take all the possible pairs of two identical elements. That's just a matter of checking which of your original elements have more than one copy.

Note that as soon as one of the original elements has two copies, adding more copies of it makes no difference.

share|improve this answer
    
thank You very much –  kkris1983 Aug 21 '13 at 10:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.