|
74 | 74 | "source": [
|
75 | 75 | "## Algorithm\n",
|
76 | 76 | "\n",
|
77 |
| - "We'll use a recursive solution that valides left <= current < right, passing down the min and max values as we do a depth-first traversal.\n", |
| 77 | + "We'll use a recursive solution that validates left <= current < right, passing down the min and max values as we do a depth-first traversal.\n", |
78 | 78 | "\n",
|
79 | 79 | "* If the node is None, return True\n",
|
80 | 80 | "* If min is set and the node's value <= min, return False\n",
|
|
123 | 123 | " raise TypeError('No root node')\n",
|
124 | 124 | " return self._validate(self.root)\n",
|
125 | 125 | "\n",
|
126 |
| - " def _validate(self, node, mininum=-sys.maxsize, maximum=sys.maxsize):\n", |
| 126 | + " def _validate(self, node, minimum=-sys.maxsize, maximum=sys.maxsize):\n", |
127 | 127 | " if node is None:\n",
|
128 | 128 | " return True\n",
|
129 |
| - " if node.data <= mininum or node.data > maximum:\n", |
| 129 | + " if node.data <= minimum or node.data > maximum:\n", |
130 | 130 | " return False\n",
|
131 |
| - " if not self._validate(node.left, mininum, node.data):\n", |
| 131 | + " if not self._validate(node.left, minimum, node.data):\n", |
132 | 132 | " return False\n",
|
133 | 133 | " if not self._validate(node.right, node.data, maximum):\n",
|
134 | 134 | " return False\n",
|
|
0 commit comments