Question: Problem 6. [Extra credit] You are given two unsorted arrays A[1 : n) and B[1:n) consisting of 2n distinct numbers such that A[1] B[n]. Design

 Problem 6. [Extra credit] You are given two unsorted arrays A[1

Problem 6. [Extra credit] You are given two unsorted arrays A[1 : n) and B[1:n) consisting of 2n distinct numbers such that A[1] B[n]. Design and analyze an algorithm that in O(log n) time finds an index j (1 : n] such that A[j] B[j +1]. Hint: Start by convincing yourself that such an index j always exist in the first place. (+10 points) Problem 6. [Extra credit] You are given two unsorted arrays A[1 : n) and B[1:n) consisting of 2n distinct numbers such that A[1] B[n]. Design and analyze an algorithm that in O(log n) time finds an index j (1 : n] such that A[j] B[j +1]. Hint: Start by convincing yourself that such an index j always exist in the first place. (+10 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 Databases Questions!