title: Algorithm for deciding if a,b,c exist in an array so that a+b+c = z?
body: <p>a little stuck finding an efficient algorithm for the following problem. The algo has to decide if there are 3 elements a,b and c in an array so that a+b+c is equal to a given number z. </p>
  
  <p>The naive way would be to try out the combinations, of course, but asymptotically the time needed would be too large. </p>
  
  <p>For finding a and b in an array so that the sum is z is much easier. Sort the given array in ascending order and check for every element if z-a exists. But I'm not sure how I'd implement it in the 3 element problem and what time would be needed. </p>
  
  <p>Any help is much appreciated!</p>
  
  <p>Edit: a,b,c and z are integers.</p>