I've two algorithms and I want some one to explain the time complexity for each one.
First Algorithm:
---------------------------------
m = n
for i=1 to n
if m is even then
for j=1 to log n
count++
end for
end if
m=m/2
end for
----------------------------------
What is the time complexity for the first algorithm? with explain please ????
Second Algorithm:
---------------------------------
while(m>1) do
if m is even then
for j=1 to log n
count ++
end for
end if
end while
---------------------------------
What is the time complexeity for the second algorithm? with explain
What is the different between them?
And what is the best and easy way to know that?