title: Algorithm for- given a set S of n integers and another integer x, determine whether or not there exist two elements in S whose sum is exactly x
body: <p>Describe an algorithm where , given a set S of n integers and another integer x, determines whether or not there exist two elements in S whose sum is exactly x. Please let me know if my algorithm is correct or what modification I need to do?
  Algorithm:</p>
  
  <pre><code>Algo(i,j,k,S)
      for (j = 1 to S.length - 1 , i++ )
         for (i= j+1 to S.length)
          A[k] = A[j] + A[i]
          if A[k] = x
            return A[i], A[j]
          else j++
  </code></pre>