https://blog.csdn.net/u012414189/article/details/83856874 C++语言基础1. 指针和引用的区别C++之父:我为啥引入引用 “引用是别名”这个概念仅仅只是在语言级别上,深入底层的话,引用必定需要存储绑定的对象的地址信息的,所以肯定会占内存。 ( ...
flatten binary tree
LeetCode 114. Flatten Binary Tree to Linked List class Solution {public: void flatten (TreeNode* root) { if (root == nullptr) ...
判断是否为平衡二叉树
LeetCode 110. Balanced Binary Tree方法一 (top down)class solution {public: int depth (TreeNode* root) { if (root == nullptr) { ...
序列化、反序列化二叉树
LeetCode 297. Serialize and Deserialize Binary Tree实现一class Codec {public: string serialize(TreeNode* root) { ostringstream out; ...
二叉树中和为某一值的路径
LeetCode 113. Path Sum II{ vector<vector<int>> pathSum(TreeNode* root, int sum) { vector<vector<int>> pa ...
判断一棵树是否为另一棵树的子结构
LeetCode 572. Subtree of Another Tree实现一bool isSubtree(TreeNode* s, TreeNode* t) { if (!s) { return false; } if (isSame ...