Question: Hi, I am stuck with this problem. Please provide me a descriptive answer. Appreciate your help!! Consider the problem of determining the maximum in an

Hi, I am stuck with this problem. Please provide me a descriptive answer. Appreciate your help!!

Consider the problem of determining the maximum in an array S containing n real numbers.

Divide-and-conquer algorithm

a. Write the problem, inputs, outputs, and algorithm in pseudo-code.

b. Let T(n) denote the number of pair-wise comparisons of elements in S required by your algorithm. Write a recurrence relation for T(n) for your algorithm and solve it to determine T(n).

c. Draw a decision tree (comparison tree) for your algorithm when S is (a, b, c, d).

i) How many comparisons does your algorithm do in the best case?

ii) How many comparisons does your algorithm do in the worst case?

d. Is your algorithm optimal? Justify your answer.

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!