Question:

Assume n is a positive integer Our goal is to find a power

Last updated: 3/14/2023

Assume n is a positive integer Our goal is to find a power

Assume n is a positive integer Our goal is to find a power function g n n such that the algorithm below is O n x 6 for i 1 to n for j 3 to 3i x x i j next j next i 1 Start by counting the number of operations performed in the inner loop This total will depend on i In each iteration of the inner loop The inner loop runs operations are performed times so the total number of operations performed in this loop is 2 With the information above we can count the number of operations the overall algorithm computes In ith iteration of the outer loop operations are performed This total depends on the value of i To get the total number of operations we need to add up the number of operations performed for each value of the total number of operations performed in this loop is That is