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