1. Serialization
[Method 1] pre-order+in-order or in-order+post-order[Problem] same nodes will cause problems in deserialization.
e.g., pre-oder = [5,5,5,5], in-order = [5,5,5,5] ->no way to figure out what exactly the tree looks like.
[Method 2] level-order serialization
(You can also trim all the "null" in the end)
2. Binary Search Tree
1. Predecessor and Successor
java.util.TreeMap support API ceiling(value) and floor(value)
[Question]
270. Closest Binary Search Tree Value
2. other BST questions
222. Count Complete Tree Nodes
230. Kth Smallest Element in a BST



No comments:
Post a Comment