From 1e05d35fcada20b5b3fdfea3dac0861c9bad0353 Mon Sep 17 00:00:00 2001 From: Donne Martin Date: Fri, 31 Mar 2017 04:49:08 -0400 Subject: [PATCH] Fix check balance challenge spacing --- .../check_balance/check_balance_solution.ipynb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/graphs_trees/check_balance/check_balance_solution.ipynb b/graphs_trees/check_balance/check_balance_solution.ipynb index f08f038..5835927 100644 --- a/graphs_trees/check_balance/check_balance_solution.ipynb +++ b/graphs_trees/check_balance/check_balance_solution.ipynb @@ -104,16 +104,16 @@ "source": [ "class BstBalance(Bst):\n", "\n", - " def _check_height(self, node):\n", + " def _check_balance(self, node):\n", " if node is None:\n", " return 0\n", - " left_height = self._check_height(node.left)\n", + " left_height = self._check_balance(node.left)\n", " if left_height == -1:\n", " return -1\n", - " right_height = self._check_height(node.right)\n", + " right_height = self._check_balance(node.right)\n", " if right_height == -1:\n", " return -1\n", - " diff = abs(left_height-right_height)\n", + " diff = abs(left_height - right_height)\n", " if diff > 1:\n", " return -1\n", " return 1 + max(left_height, right_height)\n", @@ -121,7 +121,7 @@ " def check_balance(self):\n", " if self.root is None:\n", " raise TypeError('root cannot be None')\n", - " height = self._check_height(self.root)\n", + " height = self._check_balance(self.root)\n", " return height != -1" ] }, @@ -235,7 +235,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.0" + "version": "3.4.3" } }, "nbformat": 4,