public void FindMedianSortedArrays_Even_Test() { var nums1 = new[] { 1, 3 }; var nums2 = new[] { 2 }; double ret = FindMedianSortedArrays.FindMedianSortedArraysFunc(nums1, nums2); Assert.AreEqual((double)2, ret); }
public void FindMedianSortedArrays_Odd_Sort_Test() { var nums1 = new[] { 1, 2 }; var nums2 = new[] { 3, 4 }; double ret = FindMedianSortedArrays.FindMedianSortedArraysFunc(nums1, nums2); Assert.AreEqual((double)2.5, ret); }
public void TestFindMedianSortedArraysRecursive() { var arr1 = new int[] { 1, 21, 31, 41 }; var arr2 = new int[] { 2, 4, 50 }; var r = FindMedianSortedArrays.FindKthIn2SortedArraies(arr1, 0, arr2, 0, 3); Assert.AreEqual(r, 4); var arr3 = new int[] { 1, 21, 31, 41 }; var arr4 = new int[] { 2, 4, 50, 100 }; r = FindMedianSortedArrays.FindKthIn2SortedArraies(arr3, 0, arr4, 0, 5); Assert.AreEqual(r, 31); }
public void TestFindMedianSortedArrays() { var arr1 = new int[] { 1, 21, 31, 41 }; var arr2 = new int[] { 2, 4, 50 }; var r = FindMedianSortedArrays.FindMedianSortedArrays1(arr1, arr2); Assert.AreEqual(r, 21); var arr3 = new int[] { 1, 21, 31, 41 }; var arr4 = new int[] { 2, 4, 50, 100 }; r = FindMedianSortedArrays.FindMedianSortedArrays1(arr3, arr4); Assert.AreEqual(r, 26); }
public void Debug() { ISolution solution = new FindMedianSortedArrays(); solution.Test(); }
public void Test(int[] arr1, int[] arr2, double result) { Assert.Equal(FindMedianSortedArrays.Run(arr1, arr2), result); }