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

Answer the question and discuss if you have any confusion

Re: Answer the question and discuss if you have any confusion

by Atikur Mithun -
Number of replies: 0

Answer to the question number :1

The time complexity of an algorithm is total amount of time required by an algorithm of complete its excution.the time taken by any piece of code to run is khown as the time complexity of that code.the lesser the time complexity,the faster the excution.

We can find out the minimum or maximum time taken by any algorithm through time complexity.As a result,i can use the program efficiently.

Answer to the question number :2

  Line 3: We have to declare i.

Line No 6 : - We need to keep the same in the previous counter.
In line 14: - We have to put; Latest printef ("hello");
For the circle first we can say it = 0 (n + 1). At that moment in the second step we can see that 3 circles are settled here so this answer is = n * n * n = 0 (n³) C Final result = 0 (n + 1) + 0 (n3) = 0 (NO) ) [Lower power finish] [. Higher power acceptable]


The time complexity is n³.