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

Answer of the question

Answer of the question

by Nahidul Islam -
Number of replies: 0

Ans to the question No : 01

  Time complexity is simply a measure of the time it takes for a function or expression to complete its task, as well as the name of the process to measure that time.

Ans to the question No : 02

At first I wanted to say that this code has some bug.


These are ….


·        In line 3:-  we have to declare i .

·        In line 6:-  before counter we have to also put for .

·        In line 14:-  we have to put ; in last printf (“hello”) ;

 


In first for loop we can say it’s = 0 (n+1)


Then in 2nd step we see that here is 3 nested for loop so this answer is = n*n= 0 (n2) .


Final result is = 0(n+1) + 0(n2) = 0 (n2) [ lower power finish ]


The time complexity is n2.