0
808views
Recursive functions of traversal techniques.
1 Answer
0
0views

Recursive functions of traversal techniques:

1. Pre-order traversal:

void Pre-order traversal ( start node * tree)

<

if (tree ! = NULL)

<

print f ("%\t" , tree $\rightarrow$ data);

Pre-order traversal (tree $\rightarrow$ left);

Pre-order traversal (tree $\rightarrow$ right);

3

3

2. In-order traversal:

void Pre-order traversal (struct node * tree)

<

if (tree ! = NULL)

<

Pre-order traversal (tree $\rightarrow$ left);

print f ("/t%d; tree $\rightarrow$ data);

Pre-order traversal (tree $\rightarrow$ right);

3 3

3. Post order traversal:

void Post order traversal (struct node * tree)

<

if (tree ! = NULL)

<

Post order traversal (tree $\rightarrow$ left);

Post order traversal (tree $\rightarrow$ right);

print f ("\t%, tree $\rightarrow$ data);

3

3

Please log in to add an answer.