Discussion Forum on time complexity, self referential structure (Week 2)

Answer the question

Answer the question

by 201-15-3695 Tasnim Forhad Rimon -
Number of replies: 0

Answer to the Question No 1:
The time complexity of an algorithm is the total amount of time required by an algorithm to complete its execution. ... The time taken by any piece of code to run is known as the time complexity of that code. The lesser the time complexity, the faster the execution.
Answer to the Question No 2:
At first for simple expression the time complexity is 0(1).
Then for two for loops the time comolexity is 0(n*n) = 0(n^2).
And then for other for loop the time complexity is 0(n).
At last for return the time complexity is 0(1).
So the time complexity of the code is 0(n^2).