### Introduction to N-ary Tree - The Coding Shala

In this post, we will learn what is N-ary Tree and how to traverse the N-ary Tree using Preorder and Postorder.

## Introduction to N-ary Tree

Here is an example of 3-ary tree:

## Traversal of N-ary Tree

Note: There is no standard definition for in-order traversal in n-ary trees.

**Preorder Traversal of N-ary Tree**

In an N-ary tree, preorder means visit the root node first and then traverse the subtree rooted at its children one by one.

Here is an example of Preorder Traversal of N-ary tree:

**PostOrder Traversal of N-ary Tree**

In an N-ary tree, postorder means traverse the subtree at its children first and then visit the root node itself.

Here is an example of postorder traversal of N-ary tree:

**Level-Order Traversal of N-ary Tree**

In level-order traversal, we do a breadth-first search in a tree. We visit all the nodes at the same level first then we go to the next level.

Here is an example of level-order Traversal of N-ary tree:

**Other Posts You May Like**

- Introduction of Binary Tree
- Introduction of Binary Search Tree
- Insert into Binary Search Tree
- Binary Tree PreOder Traversal
- Binary Tree Inorder Traversal

## Comments

## Post a Comment