I just started time complexities with no knowledge of it. Read through the forum and surf the web and came up with somewhat a basic understanding of it.
int control = N
while (control !=0)
CONTROL /= 2;
i came up with :
as N double itself each time x increases only by 1. therefore N= 2^X
which equals O(ln N)? am I correct?
I'm also having trouble understanding for loops such follows:
for (int i = 1; i<= N; i++)
for (int j = 1; j<= N; j++)
for (int k = 1; k<= N; k++)
code with 0(1)
I know that for each for loop is is O(N). so the time complexities for this would be O(N^3). Can someone please explain how it works in detailed?