![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法题集锦
EasonDongH
这个作者很懒,什么都没留下…
展开
-
树的同构
树的同构 描述: 给定两棵树T1和T2。如果T1可以通过若干次左右孩子互换就变成T2,则我们称两棵树是“同构”的。例如图1给出的两棵树就是同构的,因为我们把其中一棵树的结点A、B、G的左右孩子互换后,就得到另外一棵树。而图2就不是同构的。 题解: int Isomorphism(Root R1, Root R2){ if(R1 == Null && R2 == Null)//...原创 2019-08-19 15:22:56 · 333 阅读 · 0 评论 -
Symmetric Tree
Symmetric Tree 描述: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \ 3 4 4...原创 2019-08-19 15:25:01 · 101 阅读 · 0 评论 -
Validate Binary Search Tree
Validate Binary Search Tree 描述 Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys le...原创 2019-08-19 17:05:45 · 123 阅读 · 0 评论