if algorithm a has running time 9n^2+3n+3 and algorithm b has running time 7n^2 then
Answers
Answer:
Time complexity of both the algorithms are equal i.e. O().
Step-by-step explanation:
Given:- An algorithm a has a running time of and b has running time .
Solution:-
Time Complexity means the amount of time taken by an algorithm to run all its iterations.
Asymptotic Notation is a means to describe the running time of an algorithm. There are three different notations: Big Oh (O), Big Theta (Θ), and Big Omega (Ω).
Algorithm a has running time of .
Algorithm b has running time of .
While calculating time complexity, only the highest order term is considered whereas all the lower order terms are discarded.
∴ Time complexity of algorithm a is O(), and
Time complexity of algorithm b is also O().
Therefore, if algorithm a has running time and algorithm b has running time then time complexity of both the algorithms are equal i.e. O().
#SPJ3