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.

Is any algorythem that can arrange two or more different blocks in all possible ways.. in series (rows and columns.)?

If I have two colored(red and blue) blocks and I try to arranged in one possible way... see the example image.
enter image description here
please give me such solution that can arrange all possible ways to arrange blocks. If we have "N" number of block than How many ways to generate design from "N" blocks in all possible ways.

Thanks in advanced

share|improve this question
    
It's not so clear what you mean to me. How many blocks of each color are there? What additional contraints should the permutations satisfy, for instance: should adjacent blocks always have different color (like in the picture)? –  Myself Feb 1 '12 at 6:29
    
@Myself If there are two different colored box then how to arranged it in possible ways. like floor tiles. I am trying to developed floor tile design UI with possible way to arrange. If I have three different types of tile then how it possible. I finding algorithm to get me all possible ways. for eq. I have two numers 0,1 then it arrange like : 0 1 | 1 0 , if we have more than 2 numner then?? –  Abhishek Bhalani Feb 1 '12 at 6:39
    
Are the dimensions of the "floor" given? i.e. - m x n? –  Tom Feb 4 '12 at 16:43
    
@Tom Its dynamic values.. user enters m x n ( Input variables ). you can gave me solution as per fixed dimensions.. you can assume m and n variables. –  Abhishek Bhalani Feb 6 '12 at 5:07

1 Answer 1

I think you are looking for a way to encode a tiling. If you have no constraints at all, and you have $n$ places to put tiles of $b$ different colors, then the easiest encoding scheme is to represent a tiling as a base $b$ number with $n$ digits.

More explicitly, label your places with numbers $0$ through $n-1$, and label your colors $0$ through $b-1$. Then the coloring where tile $i$ is colored color $c_i$ is represented by the number $(c_{n-1}c_{n-2}\cdots c_2 c_1 c_0)_b=\sum c_i b^i$. If you want to enumerate the colorings, just list out the numbers between $0$ and $b^n-1$.

share|improve this answer
    
Thanks @Aaron for reply. I just test your equation... you can trance it by values. –  Abhishek Bhalani Feb 6 '12 at 5:08

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.