Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are given three arrays A[1 : n], B[1 : n], and C[1 : n] of positive integers. The goal is to decide whether or

You are given three arrays A[1 : n], B[1 : n], and C[1 : n] of positive integers. The goal is to decide whether or not there are indices i, j, k [1 : n] such that A[i] B[j] = C[k]; in other words, is it the case that there are numbers in A and B whose multiplication belongs to C. Examples: When n = 3, and A = [1, 3, 4], B = [2, 3, 5], and C = [1, 3, 5], the answer is Yes, because for instance we have A[1] B[3] = C[3] or A[1] B[2] = C[2]. When n = 3 and A = [1, 3, 4], B = [2, 4, 6], and C = [7, 9, 11], the answer is No. (a) Suppose all the numbers in C belong to the set 1, 2, . . . , n2 . Design and analyze an algorithm with worst-case runtime of O(n 2 ) for the problem in this case. (b) Now suppose C can be any arbitrary array of n integers. Design and analyze a randomized algorithm with expected worst-case runtime of O(n 2 ) for the problem in this case. Note: Actually, this problem also has a deterministic algorithm that runs in worst-case O(n 2 ) time. But you do not need to design such an algorithm for this problem (although if you do, you will receive the full credit for both parts (a) and (b)).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

Which case would most likely be heard in U.S. district court

Answered: 1 week ago