Question: If x , y in { 0 , 1 } ^ n are two binary strings of length n , then we say x is

If x, y in {0,1}^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 =00100 and y =10100 are neighbours, since they are the same everywhere except for the first position. On the other hand, x=00100 and y=00011 are not neighbours, since they differ in three bit positions.
Consider the following algorithmic problem. The input is a set X {0,1}^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 O((X^2)n) time. (Prove corrrectnesss as well)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!