public boolean merge(State o) {
      if (o != null) {
        state.n = o.n;
        state.a = sortedMerge(o.a, state.a, getAscending(), o.n);
      }      
      return true;
    }
Two pointers are created to track the maximal elements in both o and MaxNArray.
 The smallest element is added into tempArrayList
 Consider the sizes of o and MaxNArray may be different.
contrib/src/java/org/apache/hadoop/hive/contrib/udaf/example/UDAFExampleMaxMinNUtil.java