Question: If x , y in { 0 , 1 } ^ n are two binary strings of length n , then we say x is
If x y in n are two binary strings of length n then we say x is a neighbour of y if they differ in exactly one bit position. For example, the strings x and y are neighbours, since they are the same everywhere except for the first position. On the other hand, x and y are not neighbours, since they differ in three bit positions.
Consider the following algorithmic problem. The input is a set X n of binary strings of length n The output is to decide if X can be partitioned into neighbouring strings. Formally, it should output "Yes" if there is a partition of X into a collection of pairs of neighbouring strings such that a every string appears in at least one pair of the partition and b no string appears in two distinct pairs of the partition. It should output No if no such partition is possible. Give an efficient algorithm solving this problem. For full marks, your algorithm should run in OXn time. Prove corrrectnesss as well
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
