title: Find 2 numbers in an unsorted array equal to a given sum
body: <p>We need to find pair of numbers in an array whose sum is equal to a given value.</p>
  
  <pre><code>A = {6,4,5,7,9,1,2}
  </code></pre>
  
  <p>Sum = 10
  Then the pairs are - {6,4} , {9,1}</p>
  
  <p>I have two solutions for this . </p>
  
  <ul>
  <li>an O(nlogn) solution - sort + check sum with 2 iterators (beginning and end).</li>
  <li>an O(n) solution - hashing the array. Then checking if <code>sum-hash[i]</code> exists in the hash table or not.</li>
  </ul>
  
  <p>But , the problem is that although the second solution is O(n) time , but uses O(n) space as well.</p>
  
  <p>So , I was wondering if we could do it in <strong>O(n)</strong> time and <strong>O(1)</strong> space. And this is NOT homework!</p>