Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 Given an unsorted array A of integers of any size, n1, and an integer value x, write an algorithm as a pseudo

image text in transcribedimage text in transcribed

Question 1 Given an unsorted array A of integers of any size, n1, and an integer value x, 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. For instance, assume that array A is as follows: 10 14 3 9 22 35 92 5 9 64 Given x 9, the algorithm would find the two sums as 237 and 8. Your algorithm must handle possible special cases. Finally, the algorithm must use the smallest auxiliary/additional storage to perform what is needed. a) What is the time complexity of your algorithm, in terms of Big-O? b) What is the space complexity of your algorithm, in terms of Big-O? Question 1 Given an unsorted array A of integers of any size, n1, and an integer value x, 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. For instance, assume that array A is as follows: 10 14 3 9 22 35 92 5 9 64 Given x 9, the algorithm would find the two sums as 237 and 8. Your algorithm must handle possible special cases. Finally, the algorithm must use the smallest auxiliary/additional storage to perform what is needed. a) What is the time complexity of your algorithm, in terms of Big-O? b) What is the space complexity of your algorithm, in terms of Big-O?

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: 3

blur-text-image

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

Pro Android With Kotlin Developing Modern Mobile Apps

Authors: Peter Spath

1st Edition

1484238192, 978-1484238196

More Books

Students also viewed these Programming questions

Question

14-1. Discuss OSHA and how it operates.

Answered: 1 week ago

Question

2. Explain in detail three basic causes of accidents.

Answered: 1 week ago