title: Big O number of operations
body: <p>How do you compute the number of operations each line of code would take.</p>
  
  <p>Example.</p>
  
  <pre><code>Algorithm find2D (A,x)
      arrLength = A.length
      for j &lt;- 1 to arrLength – 1 do
           for k &lt;- 1 to arrLength – 1 do
                  if A[j][k] = x then
                    return true
            increment k
      increment j
  return false
  </code></pre>
  
  <p>I came up with this pseudo code. So I'm not really sure how to count the number of operations each line of code takes.</p>
  
  <p>So like the first loop would be 1+n operations since you have to set the j, compare j to arrLength - 1, and it will loop n-1 times. So that gives you n-1 + 1 + 1 which is n+1 operations.</p>
  
  <p>So for the second loop would it just be the same thing even though its nested.</p>
  
  <p>I'm a little confused on the <code>A[j][k] = x</code> comparison, how many operations would that be. </p>
  
  <p>Thanks.</p>