Exemple #1
0
void middle_order(BiTree &root) {
	if (root != NULL) {
		middle_order(root->lchild);
		printf("%c ", root->date);
		middle_order(root->rchild);
	}
}
Exemple #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;
}
Exemple #3
0
int main() {

	BiTree root;

	CreateBiTree(root);

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

	system("pause");
	return 0;
}
Exemple #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;
}