class FindSums {

  public List<Pair<Integer, Integer>> findLinearComplexityOrder(int[] numbers, int n) {
    validateInput(numbers);
    List<Pair<Integer, Integer>> sums = new LinkedList<Pair<Integer, Integer>>();
    Map<Integer, Integer> partialElements = new HashMap<Integer, Integer>();
    for (int number : numbers) {
      if (partialElements.containsKey(number)) {
        sums.add(new Pair<Integer, Integer>(number, partialElements.get(number)));
      } else {
        partialElements.put(n - number, number);
      }
    }
    return sums;
  }

}