I’m working through a 6-hour-long video series which covers such topics as Big O notation, algorithms, data structures, etc. : Basically, the nitty-gritty stuff that we didn’t cover in DBC.

First, a very simplified was to determine Big O –

n : If you have a single loop, your function is O(n).

n-squared : If you have nested loops, each additional loop adds one to the exponent. So, a loop in a loop would be n-squared; a loop, in a loop, in a loop, would be n-cubed, etc. These are bad news.

1 : If you have no loops at all; you go in, perform an operation, and get out, your big O is O(1).

log(n) : If you’re using any kind of recursion – or divide and conquer – your big 0 is O(log n)

On to the next lesson!

### Like this:

Like Loading...