Question: ( 1 point ) Assume n is a positive integer. Our goal is to find a power function g ( n ) = n p

(1 point)
Assume n is a positive integer. Our goal is to find a power function g(n)=np such that the algorithm below is O(np).
x:=30
for i:=|??n2??|ton
,x:=n-1
next i
The number of operations performed by this algorithm depends on whether n is even or odd.
Case 1: n is even
There are
operations performed in each run of the loop and the loop runs
times, so the total number of operations performed in this loop is
Case 2: n is odd
There are
operations performed in each run of the loop and the loop runs
times, so the total number of operations performed in this loop is
.
In either case, by the order of a polynomial theorem, we have that this algorithm is O(
.
 (1 point) Assume n is a positive integer. Our goal is

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