retagged by
360 views
2 votes
2 votes

Consider the following algorithm,

Dosomething( x, n)

{

m= n, temp= 1,z= x;

while(m>0) do

{

while((m mod z)=0) do

{

m= Floor(m/2);

z=z^2;

}

m = m-1, temp= temp* z;

}

return temp;

}

The complexity of above algorithm is

  1. Theta(log n)
  2. Theta(n log n)
  3. Theta(n^2)
  4. Theta(n)
retagged by

Please log in or register to answer this question.

Related questions

0 votes
0 votes
0 answers
4
mdboi asked Oct 29, 2022
302 views
Hello, i have a algorithm and i want to prove it with induction how can i do that ?Also i want to worst case run time analyze but i am not very good please help me please...