# How do you calculate the running time using Big-O notatation?

I’m still new to Data Structure and Algorithm and therefore I would like to ease my doubts. I’m required to find the Big-O running time of myMethod():

`` Static int doIt(int n) {            for πβ1 π‘π 100 do    -> 100              for πβ1 π‘π π do    -> n x 100                  πβ1;πβπ       -> 1            while π<π do       -> lg n           πβ(π+π)/2           -> lg n/2         end while          end for          end for          }   static int myMethod(int n) {                   π β1                   π€βπππ (π < π) {          -> lg n                         πππΌπ‘(π)            -> ?                          πβπΓ2             -> lg n         }             πππ‘π’ππ 1;   } ``

For each of the line I have inserted the answer I think would be a logical value to put e.g "-> 100". However I am not confident with the answer. These are the following questions that I would like to ask as well:

1. Does all while loop have a value of lg n?

2. If the doIt(n) method does not have a return statement, do we still add in part of calculation?

3. For the line with m <- (m+j)/2, the value I have inputted is lg n /2. Is that correct or is it some other value?

4. Whenever multiplying by 2 or dividing by 2 is it always lg 2? what if n is multiplied by 3?

Thank You