@Test public void shouldReturnTrueIfTreeIsNull() { boolean isBalanced = isTreeBalanced.check(null); assertTrue(isBalanced); }
public boolean check(BinaryNode root) { if (root == null) { return true; } else { int heightDifference = getRootHeight(root.getLeft()) - getRootHeight(root.getRight()); return Math.abs(heightDifference) <= 1; } }
IsTreeBalanced { public boolean check(BinaryNode root) { if (root == null) { return true; } else { int heightDifference = getRootHeight(root.getLeft()) - getRootHeight(root.getRight()); return Math.abs(heightDifference) <= 1; } } }
IsTreeBalanced { public boolean check(BinaryNode root) { if (root == null) { return true; } else { int heightDifference = getRootHeight(root.getLeft()) - getRootHeight(root.getRight()); return Math.abs(heightDifference) <= 1; } }  }
IsTreeBalanced { public boolean check(BinaryNode root) { if (root == null) { return true; } else { int heightDifference = getRootHeight(root.getLeft()) - getRootHeight(root.getRight()); return Math.abs(heightDifference) <= 1; } }  boolean check(BinaryNode root); }
IsTreeBalanced { public boolean check(BinaryNode root) { if (root == null) { return true; } else { int heightDifference = getRootHeight(root.getLeft()) - getRootHeight(root.getRight()); return Math.abs(heightDifference) <= 1; } }  boolean check(BinaryNode root);  }