Knowee
Questions
Features
Study Tools

Question #12What is the time complexity of this function / algorithm?def func(n): a=5 b=6 c=10 for i in range(n): for j in range(n): x = i * i y = j * j z = i * j for k in range(n): w = a*k + 45 v = b*b d = 33O(n)O(1)O(log(n))O(nlog(n))O(2^n)O(n!)O(n^2)

Question

Question #12What is the time complexity of this function / algorithm?def func(n): a=5 b=6 c=10 for i in range(n): for j in range(n): x = i * i y = j * j z = i * j for k in range(n): w = ak + 45 v = bb d = 33O(n)O(1)O(log(n))O(nlog(n))O(2^n)O(n!)O(n^2)

🧐 Not the exact question you are looking for?Go ask a question

Solution

The time complexity of the given function is O(n^2). This is because there are two nested loops that each run 'n' times, resulting in n*n = n^2 operations. The other operations outside the loops are constant time operations and do not affect the overall time complexity. Therefore, the time complexity is O(n^2).

Similar Questions

answer only

ANSWER THE ABOVE QUESTION

Answer in english

Research Question

give me only answer

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.