From 358791fbbcdb139dba9e7baba8d8d06c258ceac5 Mon Sep 17 00:00:00 2001 From: Donne Martin Date: Wed, 2 Mar 2016 07:50:28 -0500 Subject: [PATCH] Update dfs solution complexity discussion --- graphs_trees/tree_dfs/dfs_solution.ipynb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/graphs_trees/tree_dfs/dfs_solution.ipynb b/graphs_trees/tree_dfs/dfs_solution.ipynb index 9181359..1949c24 100644 --- a/graphs_trees/tree_dfs/dfs_solution.ipynb +++ b/graphs_trees/tree_dfs/dfs_solution.ipynb @@ -75,7 +75,7 @@ "\n", "Complexity:\n", "* Time: O(n)\n", - "* Space: O(h), where h is the height of the tree\n", + "* Space: O(m), where m is the recursion depth, or O(1) if using an iterative approach\n", "\n", "Note:\n", "* This is a form of a depth-first traversal\n", @@ -88,7 +88,7 @@ "\n", "Complexity:\n", "* Time: O(n)\n", - "* Space: O(h), where h is the height of the tree\n", + "* Space: O(m), where m is the recursion depth, or O(1) if using an iterative approach\n", "\n", "Note:\n", "* This is a form of a depth-first traversal\n", @@ -101,7 +101,7 @@ "\n", "Complexity:\n", "* Time: O(n)\n", - "* Space: O(h), where h is the height of the tree\n", + "* Space: O(m), where m is the recursion depth, or O(1) if using an iterative approach\n", "\n", "Note:\n", "* This is a form of a depth-first traversal" @@ -265,21 +265,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.4.3" } }, "nbformat": 4,