資料結構上機測試4.1:二叉樹的遍歷與應用1
time limit: 1000ms memory limit: 65536kb
submit statistic
problem description
輸入二叉樹的先序遍歷序列和中序遍歷序列,輸出該二叉樹的後序遍歷序列。
input
第一行輸入二叉樹的先序遍歷序列;
第二行輸入二叉樹的中序遍歷序列。
output
輸出該二叉樹的後序遍歷序列。
example input
abdcef
bdaecf
example output
dbefca
hint
author
#include
#include
#include
typedef struct no
node;
node *create(char *a,char *b,int n)
}int t;
t = p-b;
root->lchild = create(a+1,b,t);
root->rchild = create(a+1+t,p+1,n-t-1);
return root;
}void visit(node *root)
}int main()
/****
****
****
****
****
****
****
****
****
****
****
****
***user name:
result: accepted
take time: 0ms
take memory: 104kb
submit time: 2017-03-16 08:40:27
****
****
****
****
****
****
****
****
****
****
****
****
****/
資料結構上機 二叉樹
include include include using namespace std typedef char telemtype typedef struct binarytreenode node typedef node bintree 建立二叉樹,中間節點 左子樹 右子樹 node cre...
資料結構上機測試4 1 二叉樹的遍歷與應用1
time limit 1000ms memory limit 65536k 有疑問?點這裡 輸入二叉樹的先序遍歷序列和中序遍歷序列,輸出該二叉樹的後序遍歷序列。第一行輸入二叉樹的先序遍歷序列 第二行輸入二叉樹的中序遍歷序列。輸出該二叉樹的後序遍歷序列。abdcef bdaecf dbefca inc...
資料結構上機測試4 1 二叉樹的遍歷與應用1
time limit 1000ms memory limit 65536kb problem description 輸入二叉樹的先序遍歷序列和中序遍歷序列,輸出該二叉樹的後序遍歷序列。input 第一行輸入二叉樹的先序遍歷序列 第二行輸入二叉樹的中序遍歷序列。output 輸出該二叉樹的後序遍歷序...