Question: Here's a problem that occurs in automatic program analysis. For a set of variables x1, ..., Un, you are given some equality constraints, of the

Here's a problem that occurs in automatic program analysis. For a set of variables x1, ..., Un, you are given some equality constraints, of the form li = 2; and some disequality constraints, of the form li # X; . Is it possible to satisfy all of them? For instance, the constraints X1 = X2, X2 = X3, X3 = 24,21 x4 cannot be satisfied. Give an efficient algorithm that takes m constraints over n variables, and outputs whether they can be satisfied or not in time O(m log n). HINT: Construct a graph from these constraints, and try to check whether or not some vertices are connected. Here's a problem that occurs in automatic program analysis. For a set of variables x1, ..., Un, you are given some equality constraints, of the form li = 2; and some disequality constraints, of the form li # X; . Is it possible to satisfy all of them? For instance, the constraints X1 = X2, X2 = X3, X3 = 24,21 x4 cannot be satisfied. Give an efficient algorithm that takes m constraints over n variables, and outputs whether they can be satisfied or not in time O(m log n). HINT: Construct a graph from these constraints, and try to check whether or not some vertices are connected
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
