title: Confusion regarding finding the minimum difference between arrays of two element
body: <p>I came across a post <a href="https://stackoverflow.com/questions/4412170/find-the-minimum-difference-between-two-arrays">Find the minimum difference between two arrays</a><br>
  and using the concept I tried to solve a problem of SPOJ - <a href="http://www.spoj.pl/problems/ACPC11B" rel="nofollow noreferrer">http://www.spoj.pl/problems/ACPC11B</a>  but strangely I got WA (Wrong Answer) !!!!</p>
  
  <p>I then tried the simple way..<br>
  using two for loops..<br>
  Calculating the difference between each and every element ...<br>
  Then I got AC. !!!!</p>
  
  <p>Can anyone please tell me why this method<br>
  if (|A[i+1] - B[j]| &lt; |A[i] - B[j+1]|) then increment i, otherwise increment j    fails in this case ????  </p>
  
  <p>EDIT: I forgot to mention that when I implemented the first method I have already performed qsort on both the arrays...<br>
  Also in the SPOJ question, indexes of the elements whose difference is minimum are not required. Only minimum difference is required !!!</p>