Friday, Jan 19th

Last update12:59:40 PM GMT

Write C code to implement the preorder(), inorder() and postorder() traversals.

Write e-mail
Preorder


	preorder(mynode *root)

	{

	if(root)

	{

	printf("Value : [%d]", root->value);

	preorder(root->left);

	preorder(root->right);

	}

	}

	


Postorder

	postorder(mynode *root)

	{

	if(root)

	{

	postorder(root->left);

	postorder(root->right);

	printf("Value : [%d]", root->value);

	}

	}

	


Inorder

	inorder(mynode *root)

	{

	if(root)

	{

	inorder(root->left);

	printf("Value : [%d]", root->value);

	inorder(root->right);

	}

	}

	

Share this post



Web Hosting