Lintcode 65 Median of two Sorted Arrays

AC

//Description :There are two sorted arrays A and B of size m and n respectively.Find the median of the two sorted arrays.
//Challenge: The overall run time complexity should be O(log(m + n)).
//part of q532, how to find values in two sorted arrays

    /*
     * @param A: An integer array
     * @param B: An integer array
     * @return: a double whose format is *.5 or *.0
     */
    double findMedianSortedArrays(vector &A, vector &B) {
        // write your code here
        int i = A.size(), j = B.size();
        vector temp(i+j);
        int m=0,n=0,t=0;
        while (mB[n]) temp[t++]=B[n++];
            else temp[t++]=A[m++];
        }
        while (m

你可能感兴趣的:(Lintcode 65 Median of two Sorted Arrays)