Question: Below is how the arrays are represented ARRAY 1[=[1,5,6,6,9,9,9,11,11,21] Here length of ARRAY1 is m. ARRAY2[] =[6,6,9,11,21,21,21] Here length of ARRAY2 is n. Array to
![Below is how the arrays are represented ARRAY 1[=[1,5,6,6,9,9,9,11,11,21] Here length](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66e2c092767fa_46666e2c09211291.jpg)
![of ARRAY1 is m. ARRAY2[] =[6,6,9,11,21,21,21] Here length of ARRAY2 is n.](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66e2c0932cf7b_46666e2c092a336e.jpg)
Below is how the arrays are represented ARRAY 1[=[1,5,6,6,9,9,9,11,11,21] Here length of ARRAY1 is m. ARRAY2[] =[6,6,9,11,21,21,21] Here length of ARRAY2 is n. Array to be returned would be: ARRAY=[6,9,11,21] ATTN : Please be reminded that you cannot use library functions to do any of the tasks required above. Doing so would straight up result in a score of Zero ! You will solve the problem in three ways:- (2) [40 points] In a separate implementation, code up a solution in such a way that your solution solves the problem with O(nlog(m)) time complexity 2 or O(mlog(n)) time complexity. Here log means to the base of 2 . I'm sure you already know that the hint is to use Binary Search. (3) [20 points] In the form of sentences, as a comment in your code (at the bottom of your Solution 2), you are required to suggest how can Solution 2 be improved by leveraging the fact that both the arrays are already sorted. Suggest a solution so that your suggested solution can run linearly with O(m+n)O(N) time complexity. Your suggestion should be no more than 5 sentences:) Very Very Important : (1) Your code should be well commented which explains all the steps you are performing to solve the problem. A submission without code comments will immediately be deducted 15 points ! (2) As a comment in your code, please write your test-cases on how you would test your solution assumptions and hence your code. A submission without test cases will immediately be deducted 15 points ! Example of cases to be tested for are like: What if the array input which is expected does not exist - that is , input is a null. How should your code handle such a situation ? Maybe output some message like "Null input case, so no output"? What if the length of the array is one ?...so on and
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
