Question: CS 3 1 1 Challenge Problem 1 Due: September 1 7 th , 2 0 2 4 Problem 3 . Asymptotics. Given an array A

CS 311 Challenge Problem 1 Due: September 17th,2024
Problem 3. Asymptotics. Given an array A of n integers, youd like to output a two-dimensional n \times n
array B in which B[i, j]= max(A[i], A[i +1],..., A[j] for each i < j. For i >= j the value of B[i, j] can be left
as is.
for i =1,2,..., n
for j = i +1,..., n
Compute the maximum of the entries A[i], A[i +1],..., A[j].
Store the maximum value in B[i, j].
1. Find a function f such that the running time of the algorithm is O(f (n)), and clearly explain why.
2. For the same function f argue that the running time of the algorithm is also \Omega (f (n)).(This establishes
an asymptotically tight bound \Theta (f (n)))
3. Design and analyze a faster algorithm for this problem. You should give an algorithm with runtime
O(g(n)), where
limn->\infty g(n)
f (n)=0

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