Question: Find the running time function of the following algorithms as we learned in the class and then the tightest big-O notation. a) AlgorithmX(n) 1. x

Find the running time function of the following algorithms as we learned in the class and then the tightest big-O notation. a) AlgorithmX(n)

1. x <-- 1

2. for i <-- 1 to n

3. x <-- max(x,i)

4. for j <-- 1 to n2

5. x <-- max(x,j)

6. return x

b) AlgorithmY(n)

1. x <-- 1

2. for i <-- 1 to n

3. j <-- 1

4. while j

5. x <-- max(x, i*j)

6. j <-- 2*j

7. return x

c) AlgorithmZ(n)

1. x <-- 1

2. for i <-- 1 to n

3. j <-- 1

4. while j<10000

5. x <-- max(x, i*j)

6. j <-- j+1

7. return x

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!