@@ -58,9 +58,9 @@ def _is_bst(root, min_value=float('-inf'), max_value=float('inf')):
5858
5959
6060def _is_symmetric (root ):
61- """Check if the binary tree is symmetric
61+ """Check if the binary tree is symmetric.
6262
63- :param root: Root node of the binary tree
63+ :param root: Root node of the binary tree.
6464 :type root: binarytree.Node | None
6565 :return: True if the binary tree is symmetric, False otherwise.
6666 :rtype: bool
@@ -323,7 +323,7 @@ class Node(object):
323323 current node and its descendants.
324324
325325 :param value: Node value (must be a number).
326- :type value: int | float
326+ :type value: int | float | numbers.Number
327327 :param left: Left child node (default: None).
328328 :type left: binarytree.Node | None
329329 :param right: Right child node (default: None).
@@ -1128,7 +1128,9 @@ def is_bst(self):
11281128 def is_symmetric (self ):
11291129 """Check if the binary tree is symmetric.
11301130
1131- * Left subtree is a mirror of the right subtree around the center
1131+ A binary tree is symmetric if it meets the following criteria:
1132+
1133+ * Left subtree is a mirror of the right subtree about the root node.
11321134
11331135 :return: True if the binary tree is a symmetric, False otherwise.
11341136 :rtype: bool
@@ -1138,13 +1140,15 @@ def is_symmetric(self):
11381140 .. doctest::
11391141
11401142 >>> from binarytree import Node
1143+ >>>
11411144 >>> root = Node(1)
11421145 >>> root.left = Node(2)
11431146 >>> root.right = Node(2)
11441147 >>> root.left.left = Node(3)
11451148 >>> root.left.right = Node(4)
11461149 >>> root.right.left = Node(4)
11471150 >>> root.right.right = Node(3)
1151+ >>>
11481152 >>> print(root)
11491153 <BLANKLINE>
11501154 __1__
0 commit comments