next next up down toc toc mail

7.10.  Recursions on Binary Trees

There are many natural algorithms on binary trees that could be described recursivly. The scheme for recursions on binary trees is suggested in the following figure:

Procedure recursive_on_tree( node n)

[picture]

Examples:

Action = print the label of the node

Examples:

  • Tree 1:

    [picture]

Traverse the tree in (in | post | pre)-order

  • Tree 2:

    [picture]


back next up down toc toc mail


Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1998).

Last modified: 27/July/98 (12:14)