mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-03-04 14:48:45 +00:00
Polish bst challenge and solution
Add root is None input test case. Update time and space complexity discussion.
This commit is contained in:
@@ -56,7 +56,9 @@
|
||||
"### In-Order Traversal (Provided)\n",
|
||||
"\n",
|
||||
"* 5, 2, 8, 1, 3 -> 1, 2, 3, 5, 8\n",
|
||||
"* 1, 2, 3, 4, 5 -> 1, 2, 3, 4, 5"
|
||||
"* 1, 2, 3, 4, 5 -> 1, 2, 3, 4, 5\n",
|
||||
"\n",
|
||||
"If the `root` input is `None`, return a tree with the only element being the new root node."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -158,7 +160,7 @@
|
||||
" assert_equal(str(self.results), '[1, 2, 3, 5, 8]')\n",
|
||||
" self.results.clear_results()\n",
|
||||
"\n",
|
||||
" node = Node(1)\n",
|
||||
" node = insert(None, 1)\n",
|
||||
" insert(node, 2)\n",
|
||||
" insert(node, 3)\n",
|
||||
" insert(node, 4)\n",
|
||||
@@ -190,21 +192,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,
|
||||
|
||||
Reference in New Issue
Block a user