摘要: 题意: 给出一个m叉树的前,后序遍历求这样的树有多少种。Solution: 我们知道前序遍历的第一个点一定是根节点,后序遍历的最后一个点一定是根节点。 由此,我们只一要确定对于每一个节点,它有多少个儿子节点,再累乘C(m,k)。code#include #include #in... 阅读全文
posted @ 2014-07-27 10:51 keambar 阅读(330) 评论(0) 推荐(0)
摘要: 题意: 树的前,中序遍历求后序遍历。基础题。code#include #include using namespace std;string sq, sh;int len;void make (int l, int r, int t, int w) { if (l > r || t > w) r... 阅读全文
posted @ 2014-07-27 10:05 keambar 阅读(132) 评论(0) 推荐(0)