1. 前綴,后綴和中綴之間相互轉(zhuǎn)換
中綴表示轉(zhuǎn)前綴/后綴(附代碼)
針對負數(shù)的情況
前綴/中綴/后綴相互轉(zhuǎn)換
2. Tree Traversal
wiki
successor, predecessor
Iterative Preorder Traversal
Inorder Tree Traversal without Recursion
Inorder Tree Traversal without recursion and without stack
Iterative Postorder Traversal | Set 1 (Using Two Stacks)
Iterative Postorder Traversal | Set 2 (Using One Stack)
3. Morris Tree Traversal
build threaded tree, O(1) space traversal, no recursion, no stack using.
preorder, inorder, postorder traversal: Annie Kim's Blog
4. Sum Partition
如何把一堆數(shù)字分為兩堆,使它們的和相等,或者相差最小。
Partition Problem
Partition a set into two subsets such that the difference of subset sums is minimum
5. K-Sum
從一堆數(shù)里面找到 k 個數(shù),使它們的和等于 target,有多少種方式。
三維 dynamic programming
參考程序