Binary Algorithm

Written by :

Manasi Muglikar - 2012A3TS247H

This algorithm considers only the first aesthetic thats states that all the nodes that are on the same level are in a straight line as well as the second aesthetic, that in a binary tree, each left son should be posi-tioned left of its father and each right son right of its father. A counter holding the next free x-coordinate is kept for each level of the tree. We assume that each node has a width and height of one unit and that there should be one unit gaps between the levels of the tree and between the nodes across a level. In this and later algorithms, sacing between levels or nodes can be changed by modifying the spacing constants. This algorithm positions parents before children: any tree walk is acceptable so long as each node is visited after its relatives to the left on the same level. All programs assume that the father of the root is nil

Variables used :

Variables used inside the Structure(tree)

Local Variables

An example case

Right side is the terminal where you input the details, the output is seen in the left side window