mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 20:26:07 -04:00
Update and rename is_tree_symmetric.py to bt_is_tree_symmetric.py
This commit is contained in:
parent
5159d766d9
commit
7d6d6189e5
@ -2,7 +2,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# author: bt3gl
|
# author: bt3gl
|
||||||
|
|
||||||
def is_symmetrical(root: Optional[TreeNode]) -> bool:
|
|
||||||
|
def is_symmetric(root: Optional[Node]) -> bool:
|
||||||
|
|
||||||
stack = [(root, root)]
|
stack = [(root, root)]
|
||||||
|
|
||||||
@ -25,7 +26,7 @@ def is_symmetrical(root: Optional[TreeNode]) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def is_symmetrical_recursive(root: Optional[TreeNode]) -> bool:
|
def is_symmetric_recursive(root: Optional[TreeNode]) -> bool:
|
||||||
|
|
||||||
def helper(node1, node2):
|
def helper(node1, node2):
|
||||||
if (not node1 and node2) or \
|
if (not node1 and node2) or \
|
Loading…
x
Reference in New Issue
Block a user