mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-09 10:58:02 +00:00
Update dfs solution complexity discussion
This commit is contained in:
@@ -75,7 +75,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"Complexity:\n",
|
"Complexity:\n",
|
||||||
"* Time: O(n)\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",
|
"\n",
|
||||||
"Note:\n",
|
"Note:\n",
|
||||||
"* This is a form of a depth-first traversal\n",
|
"* This is a form of a depth-first traversal\n",
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"Complexity:\n",
|
"Complexity:\n",
|
||||||
"* Time: O(n)\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",
|
"\n",
|
||||||
"Note:\n",
|
"Note:\n",
|
||||||
"* This is a form of a depth-first traversal\n",
|
"* This is a form of a depth-first traversal\n",
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"Complexity:\n",
|
"Complexity:\n",
|
||||||
"* Time: O(n)\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",
|
"\n",
|
||||||
"Note:\n",
|
"Note:\n",
|
||||||
"* This is a form of a depth-first traversal"
|
"* This is a form of a depth-first traversal"
|
||||||
@@ -265,21 +265,21 @@
|
|||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 2",
|
"display_name": "Python 3",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python2"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
"name": "ipython",
|
"name": "ipython",
|
||||||
"version": 2
|
"version": 3
|
||||||
},
|
},
|
||||||
"file_extension": ".py",
|
"file_extension": ".py",
|
||||||
"mimetype": "text/x-python",
|
"mimetype": "text/x-python",
|
||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython2",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "2.7.10"
|
"version": "3.4.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
Reference in New Issue
Block a user