
二叉树
biongbiongdou
这个作者很懒,什么都没留下…
展开
-
【LeetCode】Merge Two Binary Trees(C++)
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need to merge them into a new binary tree. ...原创 2018-05-05 22:06:51 · 262 阅读 · 0 评论 -
【LeetCode】104. Maximum Depth of Binary Tree(C++)
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Note: A leaf is a node with no children.Ex...原创 2018-05-07 21:24:19 · 161 阅读 · 0 评论 -
【LeetCode】226. Invert Binary Tree(C++)
Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9to 4 / \ 7 2 / \ / \ 9 6 3 1这道题我是用递归求解的,代码如下:代码:(递归)/** * Definition for a binary tree node. * struct TreeN...原创 2018-05-07 22:02:01 · 209 阅读 · 0 评论