title: Is the Big O notation the same for memoized recursion versus iteration?
body: <p>I am using a simple example off the top of my head here</p>
  
  <pre><code>function factorial(n)
     if n==1 return 1
     else return n*factorial(n-1)
  
  function factorial(n)
      result = 1
      for i = 1 to n
          result *= n
      return result
  </code></pre>
  
  <p>Or functions that are recursive and have memoization vs. dynamic programming where you iterate over an array and fill in values, etc.</p>
  
  <p>I know that sometimes recursion is bad because you can run out of memory (tail recursion?) with the heap (or stack?), but does any of this affect O notation?</p>
  
  <p>Does a recursive memoized algorithm have the same O notation / speed as the iterative version? </p>