big-o


Big Oh notation loop manipulation


If I had two nested loops where the outer had a big oh notation of logn
and the inner had one of n does that mean the overall notion would be log2n?
because since n changes every time the outer loop executes, then the inner loop is technically running logn times but it loops n times. I apologise if this question sounds stupid. This is how the loop looks like:
outer loop runs while n>0
inner loops runs n times
n=(1/4)n
I'm sorry if my formatting is off, I spent a few minutes trying to figure out how to use latex here and couldn't quite crack it
Time complexity is O(n):
First time, inner loop iterates n times
Second time, inner loop iterates n/4 times
Third time, inner loop iterates n/16 times
...
K'th time, inner loop iterates n/(4^k) times
Summing them up:
n + n/4 + n/16 + ... + n/4^k + ... + n/(4^log_4(n))
This is sum of geometric series with:
a = n
r = 1/4
And it's sums is bounded by: (n/3/4) = 4n/3 accorsing to the formula for r < 1

Related Links

Why this code gives big-O = O(1)
Confused on how to find c and k for big O notation if f(x) = x^2+2x+1
calculating complexity of a function
Big - O notation linear and binary search [closed]
Show the O-notation for the following code fragment
Big Theta Questions
Role of lower order terms in big O notation
Finding Big O notation
Which Big-O grows faster asymptotically
Total time complexity in a method
What complexity mutiplication table code here have?
what is the worst case time complexity of 5/n?
Big O notation of simple expressiosn [closed]
Finding n0 in big O notation
Whats the dominant term in 2^n or n^2 for big O notation
Big-O simplification

Categories

HOME
httparty
cobalt
dns
webdriver
components
jelastic
apiblueprint
opendj
xbee
tivoli
jquery-ui
vert.x
pega
project-intu
comsol
shared-libraries
gruntfile
foreign-keys
sigma.js
dpdk
parcelable
exit
displaytag
xunit
strongname
froala
surveymonkey
opentk
mat
openmdao
winpe
eviews
openwhisk
servicestack-text
hivemq
sessionstorage
amazon-ses
projects-and-solutions
hackintosh
apache-stanbol
xv6
logback-groovy
apollostack
signal-strength
servermanager
httrack
mschart
remedy
boxing
dt
template-toolkit
myspace
greatest-n-per-group
i386
freepbx
tracker-enabled-dbcontext
turbo-prolog
include-guards
finalbuilder
zxspectrum
procedural-programming
nodelist
uncaught-typeerror
human-computer-interface
visual-studio-express
notorm
mbunit
poker
mantle
mkv
web-farm
pyunit
paginator
extconf.rb
objectquery
infobright
pinch
ikimagebrowserview
entitydatasource
xui
ie-compatibility-mode
silverlight-oob
cuda.net
google-wave
alsb
sqlobject
entitykey
image-capture
commercial-application

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App