L3_二叉树和分治法

Construct Tree from given Inorder and Preorder traversals

https://www.geeksforgeeks.org/construct-tree-from-given-inorder-and-preorder-traversal/

Divide and Conquer

注意遇到了树的题目,首先考虑他和他的左右子树之间有什么联系。

不在此list的同类题目

Path sum

二叉树总结

https://discuss.leetcode.com/topic/46016/learn-one-iterative-inorder-traversal-apply-it-to-multiple-tree-questions-java-solution

Tree

bst:search,insert,remove 最好logn 最差n

最差就是链表形状,最好就是balanced bst

A Perfect Binary Tree of height h (where height is the number of nodes on the path from the root to leaf) has 2h– 1 node.

Count Complete Tree Nodes

preorder建树:https://www.geeksforgeeks.org/construct-bst-from-given-preorder-traversal-set-2/

Last updated