摘要: public boolean isSymmetric(TreeNode root) { if(root == null){ return true; } return judge(root.left,root.right); } //左节点的left = 右节点的right 左节点的right = 阅读全文
posted @ 2022-10-11 12:24 lwx_R 阅读(16) 评论(0) 推荐(0)
摘要: public TreeNode mirrorTree(TreeNode root) { if(root == null){ return null; } TreeNode left=mirrorTree(root.left); TreeNode right=mirrorTree(root.right 阅读全文
posted @ 2022-10-11 12:23 lwx_R 阅读(12) 评论(0) 推荐(0)
摘要: /遍历A树,用每个节点开始与B进行比较 public boolean isSubStructure(TreeNode A, TreeNode B) { return (A != null && B != null) && (recur(A, B) || isSubStructure(A.left, 阅读全文
posted @ 2022-10-11 12:22 lwx_R 阅读(29) 评论(0) 推荐(0)