title: How to compare two patterns efficiently in C++
body: <pre><code>pattern 1: [(0,1)(2,4)] =&gt; [(2,3)(3,4)(4,5)] 
  pattern 2: [(0,1)] =&gt; [(2,3)(4,5)]
  </code></pre>
  
  <p>In my definition <code>pattern 2</code> is a subpattern of <code>pattern 1</code>, since <code>(0,1)</code> of <code>pattern 2</code> is contained by <code>(0,1)(2,4)</code> of <code>pattern 1</code> and <code>(2,3)(4,5)</code> of <code>pattern 2</code> is contained by <code>(2,3)(3,4)(4,5)</code> of <code>pattern 1</code>.</p>
  
  <p>What is appropriate and efficient algorithm to implement this comparison? Thanks:)</p>