http://211.67.33.62/JudgeOnline/problem.php?id=1014,排序二叉树
来源:互联网 发布:淘宝升级企业店铺入口 编辑:程序博客网 时间:2024/05/22 00:12
/********已知先、中序遍历,输出后序遍历**********/
#include <iostream>
#include <cstdio>
#include <cstring>
#define N 101
using namespace std;
void print(char *s1, char *s2, int n)//这是主要函数,s1指向先序遍历,s2则中序,n为长度
{
char *st = strchr(s2,s1[0]);
/********原型:extern char *strchr(const char *s,char c);
const char *strchr(const char* _Str,int _Val)
char *strchr(char* _Str,int _Ch)
头文件:#include <string.h>
功能:查找字符串s中首次出现字符c的位置
说明:返回首次出现c的位置的指针,
返回的地址是字符串在内存中
随机分配的地址再加上你所搜索的字符在字符串位置,
如果s中不存在c则返回NULL。********/
if(n==0)
return;
print(s1+1,s2,st-s2);
print(s1+1+(st-s2),st+1,n-1-(st-s2));
printf("%c",s1[0]);
}
int main()
{
int n;
char s1[N],s2[N];
scanf("%d",&n);
while(n--)
{
scanf("%s",s1);
scanf("%s",s2);
int num=strlen(s2);
print(s1,s2,num);
printf("\n");
}
return 0;
}
- http://211.67.33.62/JudgeOnline/problem.php?id=1014,排序二叉树
- Zju1290 Word-Search Wonder(http://begin.lydsy.com/JudgeOnline/problem.php?id=2768)
- http://begin.lydsy.com/JudgeOnline/problem.php?id=2770(PKU2503 Babelfish)
- http://begin.lydsy.com/JudgeOnline/problem.php?id=2774(poi病毒)
- http://acm.nyist.net/JudgeOnline/problem.php?pid=290
- http://acm.nyist.net/JudgeOnline/problem.php?pid=434
- http://acm.nyist.net/JudgeOnline/problem.php?pid=13
- http://acm.nyist.net/JudgeOnline/problem.php?pid=239
- http://acm.nyist.net/JudgeOnline/problem.php?pid=129
- http://acm.nyist.net/JudgeOnline/problem.php?pid=431
- http://acm.nyist.net/JudgeOnline/problem.php?pid=301
- http://acm.nyist.net/JudgeOnline/problem.php?pid=451
- http://acm.nyist.net/JudgeOnline/problem.php?pid=459
- http://acm.nyist.net/JudgeOnline/problem.php?pid=20
- http://acm.nyist.net/JudgeOnline/problem.php?pid=267
- http://acm.nyist.net/JudgeOnline/problem.php?pid=305
- http://acm.nyist.net/JudgeOnline/problem.php?pid=309
- http://acm.nyist.net/JudgeOnline/problem.php?pid=325
- apk和odex的合并,让软件成为完整的apk包以便反编译
- C++ primer 习题答案
- Stanford Algorithms: Design and Analysis, Part 1 [Final Exam]
- 使用libcurl实现获取目标文件大小, 下载进度显示, 断点续传等功能
- 互斥锁pthread_mutex_t的使用(转载)
- http://211.67.33.62/JudgeOnline/problem.php?id=1014,排序二叉树
- Linux命令
- 多重背包
- hdu 1532 Drainage Ditches(网络流)
- Grand [ɡrænd] Central['sentr(ə)l] Dispatch[dis'pætʃ]
- 线程同步互斥的控制方法
- 一二三
- 人物transform网络同步
- hdu 2073