11-23-2006, 05:32 PM
suppose that i have 2 arrays:
an array b[i] with i=0...7, (b=before) with for example
b0="00000000"
b1="00000000"
b2="00000000"
b3="00000000"
b4="00010000"
b5="00000000"
b6="11101111"
b7="11111111"
and an array a[i] with i=0...7, (a=after) with for example
a0="00000000"
a1="00000000"
a2="00000000"
a3="00000000"
a4="00010000"
a5="00100000"
a6="11001111"
a7="11111111"
In my mind, there is only 1 or 2 changes maximum, i mean only one or two 1 in b that will change of position and give the a array! it is very important, so i ask (and i thank if it is possible!) for a code that would be fast : there is no need to test all 8x8=64 positions in b array, only positions of 1 in the array b !!! only one or two 1 in the b array will change position!
So: I want to find the position of change(s) betwenn before (b) and after (a), i mean:
find all i and j such that bi(j)=1 AND ai(j)=0 (there is only 1 or 2 different such i maximum)
find all k and l such that bk(l)=0 AND ak(l)=1
in my example: i=6 and j=2 and k=5 and l=2
I hope you will understand my query, else please ask questions, it is very exciting and fun for me!
an array b[i] with i=0...7, (b=before) with for example
b0="00000000"
b1="00000000"
b2="00000000"
b3="00000000"
b4="00010000"
b5="00000000"
b6="11101111"
b7="11111111"
and an array a[i] with i=0...7, (a=after) with for example
a0="00000000"
a1="00000000"
a2="00000000"
a3="00000000"
a4="00010000"
a5="00100000"
a6="11001111"
a7="11111111"
In my mind, there is only 1 or 2 changes maximum, i mean only one or two 1 in b that will change of position and give the a array! it is very important, so i ask (and i thank if it is possible!) for a code that would be fast : there is no need to test all 8x8=64 positions in b array, only positions of 1 in the array b !!! only one or two 1 in the b array will change position!
So: I want to find the position of change(s) betwenn before (b) and after (a), i mean:
find all i and j such that bi(j)=1 AND ai(j)=0 (there is only 1 or 2 different such i maximum)
find all k and l such that bk(l)=0 AND ak(l)=1
in my example: i=6 and j=2 and k=5 and l=2
I hope you will understand my query, else please ask questions, it is very exciting and fun for me!