Sunday, July 31, 2016

Ternary Search Tree in C/C++

Task is to store an array of integers in a ternary search tree. Each element of the array can take one of the three values: 0, 1 or 2.

The C/C++ code is available on my GITLAB page.  The resulting tree could be plotted using Graphviz software using a dot file.  This code also contains code for generating a dot file. Once the dot file is obtained. Use the following command to generate the tree as shown below:

$ dot -Tps tst_data.dot -o tst_data.ps
$ gv tst_data.ps





No comments:

 
pre { margin: 5px 20px; border: 1px dashed #666; padding: 5px; background: #f8f8f8; white-space: pre-wrap; /* css-3 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* Internet Explorer 5.5+ */ }