Algorithm for finding conflicting relative order among list elements <p>I do not know the name of this problem (if I did, I could probably look up a solution).</p> <p><strong>Problem</strong>:</p> <p>Given two lists of integers <code>A</code> and <code>B</code>, determine whether there exists an ordering conflict between any two elements <code>x</code> and <code>y</code>, where both <code>x</code> and <code>y</code> exist in both <code>A</code> and <code>B</code>.</p> <p>For example, consider these two lists:</p> <pre><code> A : 2 3 8 9 B : 3 1 7 2 </code></pre> <p>In this case, there exists an ordering conflict <code>{ 2, 3 }</code> because those elements appear in the opposite order relative to one another in list <code>A</code> as they do in list <code>B</code>.</p> <p><strong>Trivial cases</strong></p> <p><code>A</code> and <code>B</code> have no elements in common; no conflicts.</p> <p><code>A</code> and <code>B</code> are the same list; no conflicts.</p> <p><strong>Question</strong></p> <p>What are some algorithms for solving this problem?</p>