Question: Please solve question 1 and question 2 Dont provide prove where not required please i need solution in detail of these asap As part of

 Please solve question 1 and question 2 Dont provide prove where

Please solve question 1 and question 2 Dont provide prove where not required please i need solution in detail of these asap

As part of an ongoing study, scientists in Iceland have been logging the noon temperature over the last n days. Let Til be the temperature on day i for i = 1,2, , n. Temperatures can be positive or negative. 1. Design an algorithm that finds, given a value of r, finds the set of r consecutive days with the maximum average temperature. Analyze the running time of your algorithm but no proof of correctness is required. The running time should not depend on r. 2. Consider the following algorithm that claims to determine whether there is a set of consecutive days whose average temperature is exactly 0 Step 1. Let Cl1| = T[1] and for i = 2, . . . , n, let C = T[i] + C[i-1] Step 2. Sort C by increasing value using MergeSort and let C' be the resulting array. Step 3. If there exists i such that C Ci+1, output "yes". Output 'no" otherwise (a) What is the running time of this algorithm? (b) Is the algorithm correct? Either provide an example where the algorithm returns the wrong answer or provide a brief proof of correctness

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!