The Gateway to Computer Science Excellence
0 votes
78 views

 

in Programming by Active (1.8k points) | 78 views
0
200?
0
112 ??
0

@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

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

ago by (381 points)
0
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,313 answers
198,348 comments
105,047 users