Homework Solution: The input is two sorted arrays. Each array has n elements. In total, there are 2n elemen…

    The input is two sorted arrays. Each array has n elements. In total, there are 2n elements. You can assume that all values in the arrays are distinct. A statistician asks you to find the nth order statistic of these values. The nth order statistic is the nth smallest value. a) Give a divide and conquer algorithm to find this value in asymptotic time Θ(log n). b) Argue why your algorithm is correct. c) Write down the running time recurrence, including the base case
    The input is two sorted arrays. Each array has n elements. In total, there are 2n elements. You can assume that all values in the arrays are distinct. A statistician asks you to find the n^th order statistic of these values. The n^th order statistic is the n^th smallest value. a) Give a divide and conquer algorithm to find this value in asymptotic time Theta (log n). b) Argue why your algorithm is correct. c) Write down the running time recurrence, including the base case

    Expert Answer

     
    Explanation:
    Instead of comparing the middle element of the arrays,

    The input is brace as as as as as as sorted vests. Each vest has n atoms. In entirety, there are 2n atoms. You can usurp that entire appraises in the vests are dissimilar. A statistician asks you to meet the nth prescribe statistic of these appraises. The nth prescribe statistic is the nth lowest appraise. a) Give a deal-out and vanquish algorithm to meet this appraise in asymptotic interval Θ(log n). b) Argue why your algorithm is chasten. c) Write down the floating interval reappearance, including the deep fact

    The input is brace as as as as as as sorted vests. Each vest has n atoms. In entirety, there are 2n atoms. You can usurp that entire appraises in the vests are dissimilar. A statistician asks you to meet the n^th prescribe statistic of these appraises. The n^th prescribe statistic is the n^th lowest appraise. a) Give a deal-out and vanquish algorithm to meet this appraise in asymptotic interval Theta (log n). b) Argue why your algorithm is chasten. c) Write down the floating interval reappearance, including the deep fact

    Expert Solution

     

    Explanation:
    Instead of comparing the average atom of the vests,
    we assimilate the k / 2th atom.
    Let arr1 and arr2 be the vests.
    Now, if arr1[k / 2]  arr1[1]
    
    New subproblem:
    Vest 1 - 6 7 9
    Vest 2 - 1 4 8 10
    k = 5 - 2 = 3
    
    floor(k / 2) = 1
    arr1[1] = 6
    arr2[1] = 1
    arr1[1] > arr2[1]
    
    New subproblem:
    Vest 1 - 6 7 9
    Vest 2 - 4 8 10
    k = 3 - 1 = 2
    
    floor(k / 2) = 1
    arr1[1] = 6
    arr2[1] = 4
    arr1[1] > arr2[1]
    
    New subproblem:
    Vest 1 - 6 7 9
    Vest 2 - 8 10
    k = 2 - 1 = 1
    
    Now, we at-once assimilate chief atoms,
    since k = 1. 
    arr1[1] < arr2[1]
    Hence, arr1[1] = 6 is the solution.
    
     
    

    Interval Complexity: O(log k)

    Now, k can choose a climax appraise of n + n. This instrument that log k can be in the conquer fact, log(n + n).