answersLogoWhite

0


Best Answer

I'm not giving you a full, ready-to-run code, just a skeleton program that may give you some ideas to start with. (And this way you will learn more.)

Let's suppose your tree elements look like this:

TreeElement{
integer data;
pointer leftnode, rightnode;
}

Then this is the frame of the program:

TreeWalk(TreeElement){
if(exists(leftnode)){ TreeWalk(leftnode); } //if there is a left subtree from this TreeElement, then traverse that
if(exists(rightnode)){ TreeWalk(rightnode); } //same for the right side
process(data); //do whatever you need to do
}

So this is the idea behind the postorder tree traversal, the actual details are up to you and the concrete problem.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C Program to thread the tree in post order?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Is threaded binary tree possible when you traverse a tree in post order?

Yes


Inorder traversal program in c plus plus?

In-order traversal relates to non-empty binary trees which can be traversed in one of three ways: pre-order, in-order and post-order. The current node is always regarded as being the root of the traversal, and all operations occur recursively upon that root. Pre-order: 1. Visit the root. 2. Traverse the left sub-tree. 3. Traverse the right sub-tree. In-order: 1. Traverse the left sub-tree. 2. Visit the root. 3. Traverse the right sub-tree. Post-order: 1. Traverse the left sub-tree. 2. Traverse the right sub-tree. 3. Visit the root.


What is traverse technique used in chain survey?

1. pre-order b-tree traversal. 2. in-order b-tree traversal. 3. post-order b-tree traversal


C program which accepts in order and preorder traversal outputs of a binary tree as input and prints the corresponding binary tree?

any body can help on this ?


Why is there no threading for post order traversal of a binary search tree?

You don't need it. Think about it, you can just use a stack (or a recursive function.)


Where can one purchased Post It notes in bulk?

One can find Post-It notes in bulk in various online places. One can order them directly from the Post-It note website, as well as the websites of companies such as Walmart, Dollar Tree, and Amazon.


How is popcorn used in Christmas decorations in the United States?

The white popcorn is strung together using a needle and thread to make long chains. These are draped over the tree. They can also be placed on trees outside and feed the birds. Mixed with corn syrup and food coloring they can be made into balls to hang on the tree.


How fast does a fence post have to travel to peirce a tree?

Depends on the size of the tree


How high is a tree that casts a 24 ft shadow at the same time a 12 ft post casts a shadow which is 12 ft long?

As the sun is far enough away, the rays of light are effectively parallel. This produces similar triangles with the ratio of sides the same in each case. As the shadow of the post is 12 ft and the shadow of the tree is 24 ft, the sides of the triangle of the tree are double that of the post. Assuming the post is parallel to the tree, the tree's height is twice the height of the post → tree = 12 ft × 2 = 24ft high.


How do you make a Christmas tree?

You buy some Christmas fabrics, take a needle and thread OR a sewing machine, measure the tree length around, and sew it. Glad to help!


Where can one find information on the dollar tree?

One can find information on the Dollar Tree at their local post office. The post office always has these on hand, and they will be happy to bring it out and show it to you.


What is the correct order of an oak tree in development?

the correct order of an oak tree is:acorn,seedling,sapling,and tree.