Question: This problem tests your ability to develop efficient algorithms using the divide - and - conquer approach. It s a popular interview question at leading

This problem tests your ability to develop efficient algorithms using the divide-and-conquer approach. Its a popular interview question at leading tech companies like Google, Facebook, and Amazon, where its used to assess your problem-solving skills, particularly in software engineering and data science roles. You must submit both the source code and a brief report that explains your approach, the algorithms used, and any challenges encountered. Ensure your code is well-documented, with comments explaining the purpose of key sections and functions. Your code will be evaluated on both correctness and efficiency, as well as clarity and organization. 2.1 Coding Exercise [20 points]2.1.1 Task Write a function findMedianSortedArrays(nums1, nums2) that takes two sorted arrays, nums1 and nums2 and returns the median of the two arrays. The function must run in O(log(m + n)) time. Analyze the time complexity of your implementation. [5 points]2. What is the space complexity of your solution? Discuss whether there are trade-offs between time and space complexity in your approach. [5 points]3. How does your solution ensure that the median is found in O(log(m + n)) time? Describe the key steps and techniques used to achieve this efficiency. [5 points]4. Describe how your algorithm handles the following edge cases: (a) m =0, n =1(i.e., one of the arrays is empty).[2 points](b) Arrays with equal elements (e.g., nums1=[2,2], nums2=[2,2]).[2 points](c) Arrays of drastically different sizes (e.g., nums1=[1], nums2=[1061,106]).[4 points]5. How does your algorithm perform as the values of m and n approach their limits (e.g., m + n =2000)? What are the potential bottlenecks, and how might you address them? [4 points]6. Suppose the problem was extended to find the median of three sorted arrays, nums1, nums2, and nums3. How would your approach change to handle this new constraint? [3 points]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!