May 31, 2022 |980 Views

    Number of ways to traverse an N-ary tree

      Share   Like
    Description
    Discussion

    Given an n-ary tree, count number of ways to traverse an n-ary (or a Directed Acyclic Graph) tree starting from the root vertex.
    Now we have to find the number of ways of traversing the whole tree starting from the root vertex. There can be many such ways. Some of them are listed below.
    1) N->M->K->J->B->F->D->E->C->H->I->L->A (kind-of depth first traversal). 
    2) A->B->F->D->E->K->J->G->C->H->I->N->M->L (level order traversal)

    Number of ways to traverse an N-ary tree: https://www.geeksforgeeks.org/number-of-ways-to-traverse-an-n-ary-tree/