I want to store a general tree in C using parent pointer approach (a node store pointer to its parent node only). Is there any standard library for this?
Thanks in advance
In the C programming language, we can implement a binary tree in a similar fashion like linked lists. We employ the use of structures in C.
Tree Library. A TTree represents a columnar dataset. Any C++ type can be stored in its columns. A TTree, often called in jargon tree, consists of a list of independent columns or branches, represented by the TBranch class. Behind each branch, buffers are allocated automatically by ROOT.
The tree. hh library for C++ provides an STL-like container class for n-ary trees, templated over the data stored at the nodes. Various types of iterators are provided (post-order, pre-order, and others). Where possible the access methods are compatible with the STL or alternative algorithms are available.
It begins with a root node, which contains the original key value. The root node has two child nodes; each child node might have its own child nodes. Ideally, the tree would be structured so that it is a perfectly balanced tree, with each node having the same number of child nodes to its left and to its right.
Google shows me to GNU C Library. Are you looking for something more?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With