Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose an algorithm A_1 divides (in linear time) the input into six equal parts P_1, P_2, P_3, P_4, P_5, P_6. It then makes the following

image text in transcribed

Suppose an algorithm A_1 divides (in linear time) the input into six equal parts P_1, P_2, P_3, P_4, P_5, P_6. It then makes the following 10 combinations of these parts: each odd part is combined with each even part: P_1 with P_2, P_4, P_6 and so on, and in addition P_1 is combined with P_3. The algorithm is then run recursively on each of those 10 combinations. The results of the recursive runs are combined in quadratic time to produce the final output. Another algorithm, A_2, divides the input into nine equal parts and runs on a (some number) of them recursively. It then combines the results of the recursive runs in quadratic time to produce the final output. Write the expression for the running time of each of those two algorithms. Suppose we are given two n-element sorted sequences A and B that should not be viewed as sets (that is, A and B may contain duplicate entries). (a) Describe an O(n)-time algorithm^2 for computing a sequence representing the set A intersection B. (b) If the sequences A and B are instead unsorted, what is asymptotic time complexity of the most efficient algorithm that you can construct that computes A intersection B? Describe this algorithm

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_2

Step: 3

blur-text-image_step3

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

Genetic Databases

Authors: Martin J. Bishop

1st Edition

ISBN: 0121016250, 978-0121016258

More Books

Students also viewed these Databases questions