#include "treeint.h"
#include <stdio.h>

void Interchange(TreeNode *root) {
   TreeNode *temp;
   if (root != NULL) {
      temp = root->Left;
      root->Left = root->Right;
      root->Right = temp;
      Interchange(root->Left);
      Interchange(root->Right);
   }
}

void BracketPrint(TreeNode *root) {
   if (root != NULL) {
      if ((root->Left == NULL) && (root->Right == NULL))
         printf("%d",root->Item);
      else {
         printf("(%d:",root->Item);
	 BracketPrint(root->Left);
	 printf(",");
	 BracketPrint(root->Right);
	 printf(")");
      }
   }
}

main()
{
	TreeType MyTree1, MyTree2;
	int success, i;

	BSTInitialize(&MyTree1);
		BSTInsert(1, &MyTree1);
		BSTInsert(3,&MyTree1);
		BSTInsert(2,&MyTree1);
		BSTInsert(4,&MyTree1);
		BSTInsert(5,&MyTree1);
		Interchange(MyTree1.Root);
	BracketPrint(MyTree1.Root);
}

