Answered step by step
Verified Expert Solution
Question
1 Approved 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
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
Step: 1
a Algorithm for finding sums of elements greater than x and smaller than x in a sorted array plainte...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started