Stuck with some dumb question in complexity.
I have a loop that runs O(lg(n))
time. I have another loop inside that is also O(lg(n))
so the whole complexity is O(lg(n)) * O(lg(n))
or O(lg(n)2). Can I say that the final O is O(lg(n))
because since n is a degree of 2 then
O(lg(n)) * O(lg(n)) = O(lg(n2))=O(2lg(n))=O(lg(n))
or it can't be used this way?