Question:

Published on: 23 January, 2022

What is tree traversal?

Answer:

Tree traversal is a process to visit all the nodes of a tree. Because, all nodes are connected via edges (links) we always start from the root (head) node. There are three ways which we use to traverse a tree −

- In-order Traversal
- Pre-order Traversal
- Post-order Traversal

See the below image of a binary search tree, and traverse it using all available methods −

- In-order traversal − 10 14 19 27 31 35 42
- Pre-order traversal − 27 14 10 19 35 31 42
- Post-order traversal − 10 19 14 31 42 35 27

Subjects

Trending

Write a C language function to find the in-order successor of the root of a binary tree.

View : 31

21 January, 2022

What is a self referential structure? What is difference between Union & Structure?

View : 4

27 May, 2022

Random questions

What is a Judy array?

27 May, 2022

What is tree traversal?

23 January, 2022

How insertion sort and selection sorts are different?

23 January, 2022