示例#1
0
文件: Tree.cpp 项目: fenlan/Mycode
void middle_order(BiTree &root) {
	if (root != NULL) {
		middle_order(root->lchild);
		printf("%c ", root->date);
		middle_order(root->rchild);
	}
}
示例#2
0
int middle_order(node* p,int width)
{
	if( p != NULL )
	{
		middle_order(p->left,width);
		printf("%d\t",*((int*)(p->num)) );
		Count++;
		if(Count%10 == 0)
			printf("\n");
		middle_order(p->right,width);
	}
	return 0;
}
示例#3
0
文件: Tree.cpp 项目: fenlan/Mycode
int main() {

	BiTree root;

	CreateBiTree(root);

	pre_order(root);
	middle_order(root);
	post_order(root);

	system("pause");
	return 0;
}
示例#4
0
int main(int argc,char* argv[])
{
	int src[100];
	int i;
	//print the random list to the screen
	srand( (unsigned int)(time(0)) );
	printf("The random list is:\n");
	for( i = 0; i < 100; i++)
	{
		src[i] = rand()%100;
		printf("%d\t",src[i]);
		if(i%10 == 9)
			printf("\n");
	}
	//print the result to the screen
	printf("The sorted list is:\n");
	middle_order( Sort(src,100,sizeof(int),&Compare),sizeof(int) );

	return 0;
}