I would like an example of an algorithm (or pseudocode) that shows $\log n$ running time. I know what $n$ and $n^k$ running time looks like (simple nested loops) but what does $\log n$ look like and what is a way to see if an algorithm is going to take $\log n$ time?
Thanks!
One example is computation of $a^n$ for integer $n$ which is done by successive squaring and multiplying.
This is of time $O(\ln n)$, assuming that the time for multiplying is $O(1)$.