mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-07 09:58:03 +00:00
@@ -132,14 +132,13 @@
|
||||
"\n",
|
||||
" def insert(self, data):\n",
|
||||
" if data is None:\n",
|
||||
" raise Exception('Data cannot be None')\n",
|
||||
" raise TypeError('data cannot be None')\n",
|
||||
" if self.root is None:\n",
|
||||
" self.root = Node(data)\n",
|
||||
" return self.root\n",
|
||||
" return self._insert(self.root, data)\n",
|
||||
"\n",
|
||||
" def _insert(self, node, data):\n",
|
||||
" # Constraint: Assume we are working with valid ints\n",
|
||||
" if node is None:\n",
|
||||
" return Node(data)\n",
|
||||
" if data <= node.data:\n",
|
||||
|
||||
Reference in New Issue
Block a user