Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Go Tools Window Help a CSE30 S16 HW1 pdf (page 2 of 5) Problem 2. [16 pts] Given

ID: 3677643 • Letter: G

Question

Go Tools Window Help a CSE30 S16 HW1 pdf (page 2 of 5) Problem 2. [16 pts] Given the following pseudo code: Algorithm Ex (A, n) Input: An array A storing n 2 1 integers. output: The sum of elements at even cells in A s A[01 for i 2 to n 1 by increments of 2 do s s A[i] return Answer the following questions: 2.a [4 pts] What is the Big-oorder of the memory required by the algorithm? Answer: 2.b [4 pts) What is the Big-o order of the operations required by the algorithm? Answer: 2.c [4 pts] How many times is the statement in the innermost loop executed, as a function of n? Answer: that

Explanation / Answer

2a Ans:

The big O order of memory required by the above sum of even numbers algorithm is log n.

2b Ans:

Only the addition and incrementation and comparisions opearions are required for the above sum of even numbers algorithm.

2c Ans:

The inner most loop executes (n+1)/2 times to execute the complete algorithm.

2d Ans;

The best case of the above algorithm is: O(n log (n))

The worst case of the above alogorithm is: O(n2)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote