摘要: 1、前序+中序—>树这个天勤《高分笔记》树那章的真题仿造上就有核心代码如下:S->lchild=CreateBT(pre,in,l1+i,l1+i-l2,l2,i-1);S->rchild=CreateBT(per,in,l1+i-l2+1,r1,i+1,r2);例:前序:1352467中序:532... 阅读全文
posted @ 2015-01-28 13:43 小爷 阅读(750) 评论(0) 推荐(0)
摘要: http://www.patest.cn/contests/pat-a-practise/1043 1 #include 2 #include 3 using namespace std; 4 5 struct Node 6 { 7 Node* lchild; 8 ... 阅读全文
posted @ 2015-01-28 13:41 小爷 阅读(237) 评论(0) 推荐(0)
摘要: 二叉排序树:http://www.patest.cn/contests/pat-a-practise/1064 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int ans[1002]; 7 8 int cnt = 0... 阅读全文
posted @ 2015-01-28 13:40 小爷 阅读(159) 评论(0) 推荐(0)
摘要: A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the 阅读全文
posted @ 2015-01-28 13:38 小爷 阅读(307) 评论(0) 推荐(0)
摘要: Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to ou... 阅读全文
posted @ 2015-01-28 13:37 小爷 阅读(234) 评论(0) 推荐(0)
摘要: A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number... 阅读全文
posted @ 2015-01-28 13:35 小爷 阅读(239) 评论(0) 推荐(0)