diff --git a/graphs_trees/bst_min/bst_min_challenge.ipynb b/graphs_trees/bst_min/bst_min_challenge.ipynb index 9ec1945..52e76d5 100644 --- a/graphs_trees/bst_min/bst_min_challenge.ipynb +++ b/graphs_trees/bst_min/bst_min_challenge.ipynb @@ -39,6 +39,8 @@ "* Are the array elements unique?\n", " * Yes\n", "* Can we assume we already have a Node class with an insert method?\n", + " * Yes\n", + "* Can we assume this fits memory?\n", " * Yes" ] }, @@ -90,11 +92,11 @@ "source": [ "def create_min_bst(array):\n", " # TODO: Implement me\n", - " # Calls __create_min_bst__\n", + " # Calls _create_min_bst\n", " pass \n", "\n", "\n", - "def __create_min_bst__(array, start, end):\n", + "def _create_min_bst(array, start, end):\n", " # TODO: Implement me\n", " pass" ] @@ -171,21 +173,21 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 2", + "display_name": "Python 3", "language": "python", - "name": "python2" + "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", - "version": 2 + "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" + "pygments_lexer": "ipython3", + "version": "3.5.0" } }, "nbformat": 4, diff --git a/graphs_trees/bst_min/bst_min_solution.ipynb b/graphs_trees/bst_min/bst_min_solution.ipynb index 228fe95..b4b97cc 100644 --- a/graphs_trees/bst_min/bst_min_solution.ipynb +++ b/graphs_trees/bst_min/bst_min_solution.ipynb @@ -38,6 +38,8 @@ "* Are the array elements unique?\n", " * Yes\n", "* Can we assume we already have a Node class with an insert method?\n", + " * Yes\n", + "* Can we assume this fits memory?\n", " * Yes" ] }, @@ -103,16 +105,16 @@ "def create_min_bst(array):\n", " if array is None:\n", " return\n", - " return __create_min_bst__(array, 0, len(array)-1)\n", + " return _create_min_bst(array, 0, len(array)-1)\n", "\n", "\n", - "def __create_min_bst__(array, start, end):\n", + "def _create_min_bst(array, start, end):\n", " if end < start:\n", - " return\n", + " return None\n", " mid = (start + end) // 2\n", " node = Node(array[mid])\n", - " node.left = __create_min_bst__(array, start, mid-1)\n", - " node.right = __create_min_bst__(array, mid+1, end)\n", + " node.left = _create_min_bst(array, start, mid-1)\n", + " node.right = _create_min_bst(array, mid+1, end)\n", " return node" ] }, @@ -199,21 +201,21 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 2", + "display_name": "Python 3", "language": "python", - "name": "python2" + "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", - "version": 2 + "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" + "pygments_lexer": "ipython3", + "version": "3.5.0" } }, "nbformat": 4,