title: Determining the complexities given codes
body: <p>Given a snipplet of code, how will you determine the complexities in general. I find myself getting very confused with Big O questions. For example, a very simple question:</p>
  
  <pre><code>for (int i = 0; i &lt; n; i++) {
      for (int j = 0; j &lt; n; j++) {
          System.out.println("*");
      }
  }
  </code></pre>
  
  <p>The TA explained this with something like combinations. Like this is n choose 2 = (n(n-1))/2 = n^2 + 0.5, then remove the constant so it becomes n^2. I can put int test values and try but how does this combination thing come in? </p>
  
  <p>What if theres an if statement? How is the complexity determined?</p>
  
  <pre><code>for (int i = 0; i &lt; n; i++) {
      if (i % 2 ==0) {
          for (int j = i; j &lt; n; j++) { ... }
      } else {
          for (int j = 0; j &lt; i; j++) { ... }
      }
  }
  </code></pre>
  
  <p>Then what about recursion ... </p>
  
  <pre><code>int fib(int a, int b, int n) {
      if (n == 3) {
          return a + b;
      } else {
          return fib(b, a+b, n-1);
      }
  }
  </code></pre>