Tag Archives: tree

Map between nodes and node numbers in a binary tree in C#

For more information about trees and other algorithmic topics, see my book Essential Algorithms: A Practical Approach to Computer Algorithms. Suppose you have a binary tree with the nodes numbered as shown on the right. Note that it may have … Continue reading

Posted in algorithms, drawing, graphics, mathematics | Tagged , , , , , , , , , , , , | 1 Comment

Draw a curly tree fractal using less memory in C#

To draw trees, the example Draw a curly tree fractal in C# first builds lists holding the end points of the tree’s branches. It then finds the bounds of those points, makes a transformation to center the tree nicely, and … Continue reading

Posted in algorithms, drawing, fractals, graphics, mathematics | Tagged , , , , , , , , , , , , , , | Leave a comment

Draw a curly tree fractal in C#

This example uses recursion to build a fractal tree. It starts by drawing the tree’s trunk. At the end of the trunk, it creates two branches. At the end of each branch, it creates two new branches A and B. … Continue reading

Posted in algorithms, drawing, fractals, graphics, mathematics | Tagged , , , , , , , , , , , , , , | Leave a comment

Use a queue to draw a breadth-first colored binary tree in C#

The example Draw a breadth-first colored binary tree in C# shows how to use a Stack to draw a binary tree in depth-first order. The program builds a Stack representing the bottom (trunk) level of the tree. For each level, … Continue reading

Posted in algorithms, drawing, fractals, graphics | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Draw a breadth-first colored binary tree in C#

The example Draw a colored binary tree in C# shows how to use recursion to draw a colored binary tree. If you look closely at a tree of high degree, however, you’ll notice a problem. The program draws a branch … Continue reading

Posted in algorithms, drawing, fractals, graphics | Tagged , , , , , , , , , , , , , , | 4 Comments