Question: Question 2 Given the same problem as in Question 1; however, the array is sorted. write an algorithm as a pseudo code (not a

Question 2 Given the same problem as in Question 1; however, the array is sorted. write an algorithm as a

Question 2 Given the same problem as in Question 1; however, the array is sorted. write an algorithm as a pseudo code (not a program!) that would find out the sum of all elements in the array that have values bigger than x, as well as the sum of all elements in the array that have values smaller than .x. a) Is the time complexity of your algorithm different than the one of Question 1? If so, what is it in terms of Big-O, and why is it different? b) What is the space complexity of your algorithm, in terms of Big-O? Is there any change from the space complexity in Question 1? Explain your answer. Question 2 Given the same problem as in Question 1; however, the array is sorted. write an algorithm as a pseudo code (not a program!) that would find out the sum of all elements in the array that have values bigger than x, as well as the sum of all elements in the array that have values smaller than .x. a) Is the time complexity of your algorithm different than the one of Question 1? If so, what is it in terms of Big-O, and why is it different? b) What is the space complexity of your algorithm, in terms of Big-O? Is there any change from the space complexity in Question 1? Explain your answer.

Step by Step Solution

3.39 Rating (165 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a Algorithm for finding sums of elements greater than x and smaller than x in a sorted array plainte... View full answer

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 Programming Questions!