Puzzle | Data Recovery Problem
Suppose you have three pen drives P1, P2 and P3 each having 1GB capacity. You also have 3 GB of 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 crashed then you should be able to recover 3GB data from P2 and P3. Similarly in the case of P2 and P3.
Answer: Suppose the 3GB data is divided into three groups A, B and C. Then the distribution would be like this P1-> A^B P2-> B^C P3-> C^A 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 the below steps to recover the whole data.
Step 1 : XOR of 3Gb data with data of P1 gives (A^B^C)^(A^B) = C
Step 2 : XOR of 3Gb data with data of P2 gives (A^B^C)^(B^C) = A
Step 3 : XOR of 3Gb data with data of P1 ^ P2 gives (A^B^C)^(B^C)^(A^B) = B
Performing the above-mentioned steps will give the data A, B, and C. Similarly, we can perform these steps in the case of the loss of other pen drives.