代码改变世界

随笔档案-2012年5月9日

NYOJ 202 红黑树 数组模拟中序遍历

2012-05-09 08:35 by javaspring, 319 阅读, 收藏,
摘要: 题目其实在迷惑人了,红黑树经过旋转后中序遍历其实是不变的,所以不用管下面的旋转,直接输出中序遍历就可以了。可以用数组模拟实现树的中序遍历。 题目连接:http://acm.nyist.net/JudgeOnline/problem.php?pid=202ac代码:#include <iostream> #include <cstdio> #include <string.h> using namespace std; const int N = 15; int x[N],y[N],z[N],leftp[N],rightp[N]; void midorder( 阅读全文