     ]
    },
    {
     "cell_type": "code",
     "execution_count": 5,
     "metadata": {
      "collapsed": false
     },
     "outputs": [
      {
 
</s> remove    "execution_count": 4,
 </s> add    "execution_count": 3, </s> remove    "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Overwriting height.py\n"
     ]
    }
   ],
   "source": [
    "%%writefile height.py\n",
    "def height(node):\n",
    "    if node is None:\n",
    "        return 0\n",
    "    return 1 + max(height(node.left), \n",
    "                   height(node.right))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
 </s> add  </s> remove     "def height(node):\n",
    "    # TODO: Implement me\n",
    "    pass"
 </s> add     "class BstHeight(Bst):\n",
    "\n",
    "    def height(self, node):\n",
    "        # TODO: Implement me\n",
    "        pass" </s> remove     "%run height.py"
 </s> add     "class BstHeight(Bst):\n",
    "\n",
    "    def height(self, node):\n",
    "        if node is None:\n",
    "            return 0\n",
    "        return 1 + max(self.height(node.left),\n",
    "                       self.height(node.right))" </s> remove         root = Node(5)
        assert_equal(height(root), 1)
        insert(root, 2)
        insert(root, 8)
        insert(root, 1)
        insert(root, 3)
        assert_equal(height(root), 3)
 </s> add         bst = BstHeight(Node(5))
        assert_equal(bst.height(bst.root), 1)
        bst.insert(2)
        bst.insert(8)
        bst.insert(1)
        bst.insert(3)
        assert_equal(bst.height(bst.root), 3)
   "execution_count": 4,
     ]
    },
    {
     "cell_type": "code",
   "execution_count": 4,
     "metadata": {
      "collapsed": false
     },
     "outputs": [
      {
keep keep keep keep replace keep keep keep keep keep
 Move tree height to a class 
graphs_trees/tree_height/height_solution.ipynb