search
Log In
0 votes
170 views

 

in Programming 170 views
1
200?
0
112 ??
1

@Magma inside we have two loops which have O(n+logn)...

and 2 outside loop runs for O(n)

so overall = 0(n(n+logn)) = O(n2) ?

.

check once ! i have cross checked maybe i missed somewhere...

 

0
Yeah you're right

I did silly mistake :p
0
What's the answer ? 200 ?

1 Answer

0 votes

I am getting 100 :( for Bound=1 loop is running 1*(n+logn) times, for Bound=2 its running 2*(n+logn) times and so on ..

So, the series i am getting is n+2n+4n+8n+... which comes out to be O(n).

kindly correct me if something wrong @srestha@Arjun@Habibkhan

Related questions

0 votes
0 answers
1
188 views
Please show the ideal way to deal with such comparisons as I am getting g>=f IN genral what logic shall be followed to analyse such complex comparions?
asked Jan 6, 2019 in Algorithms Markzuck 188 views
0 votes
0 answers
2
288 views
cant we write the recurrance relation for bar() as T(n) = 5T(n-1) + c, like cant we take both the recurrance call as combined as both have same parameter? and if not, then how to solve such?
asked Dec 29, 2018 in Algorithms Markzuck 288 views
1 vote
0 answers
3
252 views
What is the time complexity of the below code? for($k=n^{10};k \geq 5;k=k^{\frac{1}{7}},k=k^2$) { $k=k^5;$ $k=k-10$ } My answer comes to be $O(log_{\frac{7}{10}}log_5(n^{10}))$ Please verify.
asked Jul 14, 2018 in Algorithms Ayush Upadhyaya 252 views
2 votes
2 answers
4
367 views
What is the time complexity of this code?
asked Apr 5, 2018 in Algorithms gauravkc 367 views
...