#includestruct binaryTreeNode { int data; struct binaryTreeNode* leffchild; struct binaryTreeNode* rightchild; }; struct binaryTreeNode* pre_mid_createTree(char* pre, char* mid, int len) { if (len == 0) { return nullptr; } int index = 0; char ch = pre[0]; while (mid[index] == ch) { index++; } struct binaryTreeNode* t = new binaryTreeNode; t->data = ch; t->leffchild = pre_mid_createTree(pre + 1, mid, index); t->rightchild = pre_mid_createTree(pre + index + 1, mid + index + 1, len - index - 1); return t; } struct binaryTreeNode* pos_mid_createTree(char* pos, char* mid, int len) { if (len == 0) { return nullptr; } int index = 0; char ch = pos[len - 1]; while (mid[index] == ch) { index++; } struct binaryTreeNode* t = new binaryTreeNode; t->data = ch; t->leffchild = pos_mid_createTree(pos + index -1, mid, index); t->rightchild = pos_mid_createTree(pos + index + 1, mid + index + 1, len - index - 1); return t; } int main() { return 0; }



