QUESTION

Text
Image

Algorithm


Determine the big O running time of the method myMethod() by counting the approximate number of operations it performs. Show all details of your answer. Note: the symbol \% represent a modulus operator, that is, the remainder of a number divided by another number. static int myMethod $(A[], n)\{$ count $\leftarrow 0$ for $i \leftarrow 0$ to $n-1\{$ for $j \leftarrow i$ to $n-1$ do count $\leftarrow$ count $+A[j]$ $k \leftarrow 1$ while $\left(k<n^{2}\right)\{$ if $(j \% 2==0)\{$ count $=$ count +1 \}$\quad k++$ $\quad j=j / 2$ \}$\quad$ return count static int myMethod $(A[], n)\{$ count $\leftarrow 0$ for $i \leftarrow 0$ to $n-1\{$ for $j \leftarrow i$ to $n-1 d o$ count $\leftarrow$ count $+A[j]$ $k \leftarrow 1$ while $\left(k<n^{2}\right)\{$ if $(j \% 2==0)\{$ count $=$ count +1 \} $k++$ $j=j / 2$ \} \} return count \}

Public Answer

T1FLMR The First Answerer