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

Division-remainder hashing, According to this, key value is divided by any ...

According to this, key value is divided by any fitting number, generally a prime number, and the division of remainder is utilized as the address for the record. The choice of s

Time converstion, how to convert 12 hour format into 24 hour format using c...

how to convert 12 hour format into 24 hour format using c program

A sort which relatively passes by a list, A Sort which relatively passes by...

A Sort which relatively passes by a list to exchange the first element with any element less than it and then repeats with a new first element is called as      Quick sort.

Sorting algorithm is best if the list is already sorted, Which sorting algo...

Which sorting algorithm is best if the list is already sorted? Why? Insertion sort as there is no movement of data if the list is already sorted and complexity is of the order

Illustrate trivariate colour models, Illustrate Trivariate Colour Models ...

Illustrate Trivariate Colour Models Conventional colour models based on the tristimulus theory all contain three variables and so are called trivariate models. Let us now consi

Compare and contrast various sorting techniques, Q. Compare and contrast va...

Q. Compare and contrast various sorting techniques or methods with respect to the memory space and the computing time.

Compound interest, Write the algorithm for compound interest

Write the algorithm for compound interest

Algorithm, algorithm to search a node in linked list

algorithm to search a node in linked list

Discuss the brute force algorithm, Question 1 What do you mean by Amortiza...

Question 1 What do you mean by Amortization? Question 2 Explain the following Big Oh notation (O) Omega notation (Ω) Theta notation (Θ)   Question 3 Di

Parallel implementation of the raytracer, You are supposed to do the follow...

You are supposed to do the following: Write a parallel implementation of the raytracer using pthreads. Measure and compare the execution times for (i) the sequential ver

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