3 double func3 Ciut [] A)E ine coune = Oi int sum Randam prng = new RandomeC); Cire izo; coure <2588i
I am confusing about the worst time case complexity for these two questions.
More precisely, I am confused about the complexity of the if-statement.
first nested loop complexity will just have constant times
over summation of i=0 to n-1, which results in n
inner loop will have summation of j=0 to n-2, which results in n-1
so I might conclude this is constant operation * n * (n-1) * complexity of if-statement.
this would go similar with second problem too,
would this if statements that does constant amount of work such like count++ according to conditions will be Theta(1) for the worst case time running? or will it be something else?
Would be glad to know how this works step by step, thank you.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps