本文总结下二叉树常见的算法题,包括树的遍历
、路径问题
、构造
和二叉搜索树
。
遍历二叉树
- 1、[104] Maximum Depth of Binary Tree
- 2、[110] Balanced Binary Tree
- 3、[543] Diameter of Binary Tree
- 4、[226] Invert Binary Tree
- 5、[617] Merge Two Binary Trees
- 6、[572] Subtree of Another Tree
- 7、[101] Symmetric Tree
- 8、[111] Minimum Depth of Binary Tree
- 9、[404] Sum of Left Leaves
- *10、[687] Longest Univalue Path
- 11、[337] House Robber III
- *12、[671] Second Minimum Node In a Binary Tree
- 13、[637] Average of Levels in Binary TreeNode
- 14、[513] Find Bottom Left Tree Value
- 15、[144] Binary Tree Preorder Traversal
- 16、[145] Binary Tree Postorder Traversal
- 17、[94] Binary Tree Inorder Traversal
- 18、[100] Same Tree
- 19、[515] Find Largest Value in Each Tree Row
- 20、[222] Count Complete Tree Nodes
路径问题
- *1、[112] Path Sum
- 2、[113] Path Sum II
- *3、[437] Path Sum III
- 4、[129] Sum Root to Leaf Numbers
- 5、[257] Binary Tree Paths
构造二叉树
- 1、[105] Construct Binary Tree from Preorder and Inorder Traversal
- 2、[106] Construct Binary Tree from Inorder and Postorder Traversal
- 3、[889] Construct Binary Tree from Preorder and Postorder Traversal
BST
- 1、[669] Trim a Binary Search Tree
- 2、[230] Kth Smallest Element in a BST
- *3、[538] Convert BST to Greater Tree
- *4、[235] Lowest Common Ancestor of a Binary Search Tree
- *5、[236] Lowest Common Ancestor of a Binary Tree
- 6、[108] Convert Sorted Array to Binary Search Tree
- 7、[109] Convert Sorted List to Binary Search Tree
- 8、[653] Two Sum IV - Input is a BST
- 9、[530/783] Minimum Absolute Difference in BST
- *10、[501] Find Mode in Binary Search Tree
- *11、[96] Unique Binary Search Trees
- 12、[98] Validate Binary Search Tree
一位喜欢提问、尝试的程序员
(转载本站文章请注明作者和出处 姚屹晨-yaoyichen)