### Tree

0 已关注
40篇博文
• #### 树相关算法

判断二叉树的后序遍历序列多叉树的构建二叉树中和为某一值的路径树的子结构对称的二叉树二叉搜索树与双向链表之字形打印二叉树分行从上到下打印二叉树树的子结构208. Implement Trie (Pref...

2018-03-13 21:35
30
• #### 树的子结构

题目：输入两棵二叉树A和B，判断B是不是A的子结构struct BinaryTreeNode { double m_dbValue; BinaryTre...

2018-03-17 09:47
11
• #### 对称的二叉树

bool isSymmetrical(BinaryTreeNode* pRoot) { return isSymmetrical(pRoot, pRoot); } bool isSymmet...

2018-03-17 09:52
16
• #### 分行从上到下打印二叉树

void Print(BinaryTreeNode* pRoot) { if(pRoot == nullptr) return; std::queue&amp;lt;...

2018-03-17 10:20
39
• #### 之字形打印二叉树

void Print(BinaryTreeNode* pRoot) { if(pRoot == nullptr) return; std::stack&amp;lt;...

2018-03-17 10:28
10
• #### 二叉搜索树与双向链表

BinaryTreeNode* Convert(BinaryTreeNode* pRootOfTree) { BinaryTreeNode *pLastNodeInList = nullptr...

2018-03-17 10:34
11
• #### 二叉树中和为某一值的路径

输入一颗二叉树和一个整数，打印出二叉树中结点值的和为输入整数的所有路径。路径定义为从树的根结点开始往下一直到叶结点所经过的结点形成一条路径。void findPath(BinaryTreeNode* ...

2018-03-15 08:39
22
• #### 208. Implement Trie (Prefix Tree)

Implement a trie with insert, search, and startsWith methods.Note:You may assume that all inputs are...

2018-03-14 08:19
26
• #### 450. Delete Node in a BST

Given a root node reference of a BST and a key, delete the node with the given key in the BST. Retur...

2018-01-24 08:25
51
• #### 101. Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For ...

2018-01-29 08:17
41
• #### 404. Sum of Left Leaves

Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ ...

2018-01-30 08:40
41
• #### 606. Construct String from Binary Tree

You need to construct a string consists of parenthesis and integers from a binary tree with the preo...

2018-01-30 08:53
47
• #### 652. Find Duplicate Subtrees

Given a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only ne...

2018-01-31 08:23
57
• #### 449. Serialize and Deserialize BST

Serialization is the process of converting a data structure or object into a sequence of bits so tha...

2018-01-31 08:57
72
• #### 310. Minimum Height Trees

For a undirected graph with tree characteristics, we can choose any node as the root. The result gra...

2018-02-01 09:10
74
• #### 230. Kth Smallest Element in a BST

Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. N...

2018-02-02 08:49
46
• #### 671. Second Minimum Node In a Binary Tree

Given a non-empty special binary tree consisting of nodes with the non-negative value, where each no...

2018-02-02 09:02
63
• #### 222. Count Complete Tree Nodes

Given a complete binary tree, count the number of nodes. Definition of a complete binary tree fro...

2018-02-03 20:28
60
• #### 114. Flatten Binary Tree to Linked List

Given a binary tree, flatten it to a linked list in-place. For example, Given 1 ...

2018-02-03 21:59
295
• #### 235. Lowest Common Ancestor of a Binary Search Tree

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BS...

2018-02-03 22:09
35