@Test public void getHalfOfNthElementInTwoSameLengthArray() { int N = 100000; for (int i = 10; i <= N * 5; i *= 2) { int[] A = getRandomArray(N, -i / 2, i / 2); int[][] input = new int[2][]; checkOneSituation(A, N / 2, input); long st = System.nanoTime(); Assert.assertEquals(A[N / 2 - 1], SelectionInTwoSortedArray.getHalfOfNthElementInTwoSameLengthArray(input[0], input[1])); Assert.assertTrue((System.nanoTime() - st) < oneMilliSec); } }
public static int getHalfOfNthElementInTwoSameLengthArray(int[] A, int[] B) { assert A.length == B.length; int k = A.length; if (k <= 0) { throw new IllegalArgumentException("invalid k " + k); } return help(A, B, k); }
SelectionInTwoSortedArray { public static int getHalfOfNthElementInTwoSameLengthArray(int[] A, int[] B) { assert A.length == B.length; int k = A.length; if (k <= 0) { throw new IllegalArgumentException("invalid k " + k); } return help(A, B, k); } }
SelectionInTwoSortedArray { public static int getHalfOfNthElementInTwoSameLengthArray(int[] A, int[] B) { assert A.length == B.length; int k = A.length; if (k <= 0) { throw new IllegalArgumentException("invalid k " + k); } return help(A, B, k); }  }
SelectionInTwoSortedArray { public static int getHalfOfNthElementInTwoSameLengthArray(int[] A, int[] B) { assert A.length == B.length; int k = A.length; if (k <= 0) { throw new IllegalArgumentException("invalid k " + k); } return help(A, B, k); }  static int getHalfOfNthElementInTwoSameLengthArray(int[] A, int[] B); static int getHalfOfNthElementInTwoArray(int[] A, int[] B); static int getKthElementInTwoArray(int[] A, int[] B, int k); }
SelectionInTwoSortedArray { public static int getHalfOfNthElementInTwoSameLengthArray(int[] A, int[] B) { assert A.length == B.length; int k = A.length; if (k <= 0) { throw new IllegalArgumentException("invalid k " + k); } return help(A, B, k); }  static int getHalfOfNthElementInTwoSameLengthArray(int[] A, int[] B); static int getHalfOfNthElementInTwoArray(int[] A, int[] B); static int getKthElementInTwoArray(int[] A, int[] B, int k);  }