7.19-经典难问题总结

1. 前缀,后缀和中缀之间相互转换

中缀表示转前缀/后缀(附代码)
针对负数的情况
前缀/中缀/后缀相互转换

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

如何把一堆数字分为两堆,使它们的和相等,或者相差最小。
Partition Problem
Partition a set into two subsets such that the difference of subset sums is minimum

5. K-Sum

从一堆数里面找到 k 个数,使它们的和等于 target,有多少种方式。
三维 dynamic programming
参考程序

6. KMP (Knuth-Morris-Pratt)

时间复杂度最优的pattern match算法,比较难理解。
wiki
更详细的讲解:
cnblog

你可能感兴趣的:(7.19-经典难问题总结)