I have found many solutions that add a compilation elements to all possible orders, but all the elements are always in every result I use them once to be reusable. For example if the input element is {"a", "b", "c"} and the number is 2 then the output should be {"a" {"a", "b"}, { {"B", "A"}, {"B", "B"}, {"B" "C"}, {"c", "a"}, {"A" C "," b "}, {" a "," c "}.
indicates that you have an input element, and you want a k-long combination.
All you need to do is base N, definitely scotched, in all the digits, which are the digits of the number.
Therefore, N = {n0, n1, ... nN}
The numbers you will start from [nnnn], and [nn nn .. NN ... NN]
If you understand how to count on any other basis, you can help
each number that you Calculate the map with any one of the required K-long combinations.
I think one example will help I will use my values, N = {A, B, C}, then we rely on base 3 To do. Since we want a 2-long combination, we only care about the 2-digit number. The smallest 2-digit base is 3 numbers 00, so we start there. By counting in base 3, we receive: OK, now these numbers are a combination To change in Remember, our set {a, b, c} So whenever we see 0, this implies 1. Wherever we look 1, it means 2, I'm sure you can guess what 2 represents :)
00 01 02 10 11 12 20 21 22
00 aa 01 ab 02 ac 10 = 0> A BA111 = & gt; Bbb122 = & gt; CBC 20 CA 21 CB 22cc
No comments:
Post a Comment