k-ary tree in Data Structure

Data StructureAnalysis of AlgorithmsAlgorithms

In this section we will see what is the K-ary tree. The K-ary tree is a rooted tree, where each node can hold at most k number of children.

If the value of k is 2, then this is known as binary tree. The binary tree, or ternary trees are some specialized k-ary trees. So k-ary trees re generalized.

Example of K-ary Tree

In the above example, there is a root. The root has four children. Each child of root has some children also. The first child has three children, the second child has no child, the third one has two children, and the last child has four children.

Published on 11-Aug-2020 10:16:35