Median of Two Sorted Arrays

题目

There are two sorted arrays nums1 and nums2 of size m and n respectively.

Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).


Example 1:
nums1 = [1, 3]
nums2 = [2]

The median is 2.0
Example 2:
nums1 = [1, 2]
nums2 = [3, 4]

The median is (2 + 3)/2 = 2.5

题解

/**
    问题描述:
        给定两个已经排序的数组num1, num2 数组长度分别为 m , n 
        查找两个数组的中位数。运行时间复杂度应该为 O(log(m + n))

    问题示例: 
        num1 = [1,3]
        num2 = [2]
             2.0 
        num1 = [1,2]
        num2 = [3,4]
            (2+3)/2 = 2.5
    问题重点: 
        1. 两个排序数组  
        2. 中位数  
        3. 时间复杂度 O(log(m + n))

    问题疑点:



    解题思路:


 */

// Version 1 

class Solution_v1 {

}
/**
    问题总结: 


 */

/**---------------------------------------------- */


/**
    算法总结: 

 */


/** 
 * 
 * 算法测试
 * 
 */

class Test {
    public static void main(String[] args) {
        System.out.println("测试结果"); 
        String str = "abacdefgeabcdef";


    }
}
Copyright © 抓🐱的🐟.com 2017 all right reserved,powered by Gitbook该文件修订时间: 2020-03-13 07:05:40

results matching ""

    No results matching ""