      "collapsed": false
     },
     "outputs": [],
     "source": [
      "n = 7\n",
      "cache = [None] * (n + 1)\n",
      "\n",
      "def fib_dynamic(n):\n",
      "    if n == 0 or n == 1:\n",
      "        return n\n",
      "    if cache[n] != None:\n",
 
</s> remove     "collapsed": true
 </s> add     "collapsed": false </s> remove     "        return fib(n-1) + fib(n-2)\n",
 </s> add     "        return fib_recursive(n-1) + fib_recursive(n-2)\n", </s> remove     "for i in xrange(0, 10):\n",
 </s> add     "for i in xrange(0, num_items):\n", </s> remove     "for i in xrange(0, 10):\n",
 </s> add     "for i in xrange(0, num_items):\n",
    "cache = [None] * (num_items + 1)\n",
      "collapsed": false
     },
     "outputs": [],
     "source": [
    "cache = [None] * (num_items + 1)\n",
    "cache = [None] * (num_items + 1)\n",
      "\n",
      "def fib_dynamic(n):\n",
      "    if n == 0 or n == 1:\n",
      "        return n\n",
      "    if cache[n] != None:\n",
keep keep keep keep replace replace keep keep keep keep keep
 Fixed fib function errors not initially caught from cached values in the IPython kernel.  Code cleanup. 
recursion-dynamic/fibonacci.ipynb