Postorder traversal of a binary tree, Data Structure & Algorithms

Assignment Help:

Postorder traversal of a binary tree

struct NODE

{

struct NODE *left;

int value;     /* can take any data type */

struct NODE *right;

};

postorder(struct NODE *curr)

{

if(curr->left != NULL) postorder(curr->left);

if(curr->right != NULL) postorder(curr->right);

printf("%d", curr->value);

}

In a preorder traversal, first (pre) the root is visited and then the left & right sub- trees are traversed. In a postorder traversal, first the left sub-tree is visited, followed by right sub-tree which is then followed through root. In inorder traversal, first the left sub- tree is visited, followed by root, followed by right sub-tree.


Related Discussions:- Postorder traversal of a binary tree

Infix expression to postfix form using the stack function, Q. Convert the f...

Q. Convert the following given Infix expression to Postfix form using the stack function: x + y * z + ( p * q + r ) * s , Follow general precedence rule and suppose tha

Linear array, representation of linear array

representation of linear array

Breadth-first search, Breadth-first search starts at a given vertex h, whic...

Breadth-first search starts at a given vertex h, which is at level 0. In the first stage, we go to all the vertices that are at the distance of one edge away. When we go there, we

Draw a flowchart to input start time and end time of vehicle, Speed cameras...

Speed cameras read the time a vehicle passes a point (A) on road and then reads time it passes a second point (B) on the same road (points A and B are 100 metres apart). Speed of t

Linear array - numerical, Q. A linear array A is given with lower bound as ...

Q. A linear array A is given with lower bound as 1. If address of A[25] is 375 and A[30] is 390, then find address of A[16].

Illustrate the back face detection method, Illustrate the Back Face Detecti...

Illustrate the Back Face Detection Method A single polyhedron is a convex solid, which has no external angle between faces less  than 180° and there is a simple object space me

Creation of a linked list, Program: Creation of a linked list In the ne...

Program: Creation of a linked list In the next example, wewill look to the process of addition of new nodes to the list with the function create_list(). #include #includ

Simulation of queues, Simulation is the process of making an abstract model...

Simulation is the process of making an abstract model of a real world situation in order to be aware of the effect of modifications and alterations and the effect of introducing nu

Programme in c to create a single linked list, Q. Write  down a   p...

Q. Write  down a   programme  in  C  to  create  a  single  linked  list also  write the functions to do the following operations (i)  To insert a new node at the end (ii

The threaded binary tree, By changing the NULL lines in a binary tree to th...

By changing the NULL lines in a binary tree to the special links called threads, it is possible to execute traversal, insertion and deletion without using either a stack or recursi

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd