recategorized by
650 views
0 votes
0 votes

Consider the following algorithm (Note: For positive integers, $p,q,p/q$ denotes the floor of the rational number $\dfrac{p}{q}$, assume that given $p,q,p/q$ can be computed in one step):

$\textbf{Input:}$ Two positive integers $a,b,a\geq b.$

$\textbf{Output:}$ A positive integers $g.$

while(b>0) {
             x = a – (a/b)*b;
             a = b;
             b = x;
        }

g = a;

Suppose $K$ is an upper bound on $a$. How many iterations does the above algorithm take in the worst case?

  1. $\Theta(\log K)$
  2. $\Theta({K})$
  3. $\Theta({K\log K})$
  4. $\Theta({K^{2}})$
  5. $\Theta({2^{K}})$
recategorized by

Please log in or register to answer this question.

Answer:

Related questions

9 votes
9 votes
4 answers
1
admin asked Feb 10, 2020
4,635 views
Among the following asymptotic expressions, which of these functions grows the slowest (as a function of $n$) asymptotically?$2^{\log n}$$n^{10}$$(\sqrt{\log n})^{\log ^{...