Puzzle | Data Recovery Problem
Suppose you have three pen drives P1, P2 and P3 each having 1GB capacity. You have also 3GB data. You have to divide these data into P1, P2 and P3 such that if any one of the pen drive among P1, P2, P3 got crashed than you should be able to recover all the data from remaining two pen drives.
For example – if P1 is crashed then you should be able to recover 3GB data from P2 and P3.
Similarly in the case of P2 and P3.
Suppose the 3GB data is divided into three groups A, B and C. Then the distribution would be like this
Now suppose pen drive P3 is lost and we are left with data of P1 and P2. As we know that
P1 contains data which is xor of A and B.
P2 contains data which is xor of B and C.
We can perform below steps to recover the whole data.
Step 1 : XOR of P1 and P2 gives (A^B)^(B^C) = B
Step 2 : XOR of this B which is obtained from step 1 with P1 gives (A^B)^B = A
Step 3 : XOR of this B which is obtained form step 1 with P2 gives (B^C)^C = C.
Performing the above-mentioned steps will give the data A, B, and C.
Similarly, we can perform these steps in the case of P1 and P2.