|
| | Tree () |
| | ~Tree () |
| | Deletes every node in the tree.
|
| void | clear () |
| | Removes every node, leaving an empty tree.
|
| bool | contains (const T &value) |
| | True if value exists anywhere in the tree.
|
| bool | contains (Node *node, const T &value) |
| | True if value exists in the subtree rooted at node.
|
| void | inOrder () |
| | Traverses the tree in-order (left, node, right).
|
| void | insert (const T &value) |
| | Inserts value, keeping BST ordering (duplicates go right).
|
| void | remove (const T &value) |
| | Removes value from the tree, if present.
|
template<typename T>
class Sleak::Tree< T >
Implements a binary tree data structure for hierarchical data organization.
The BinaryTree class organizes data in a hierarchical manner with nodes and edges, where each node has at most two children. It is suitable for scenarios where you need to represent hierarchical relationships, such as file systems, decision trees, or expression trees. Use this class when you need to implement tree-based algorithms, search trees, or hierarchical data storage.
Example Use Cases:
- Representing a file system directory structure.
- Implementing decision trees in machine learning.
- Storing and evaluating arithmetic expressions.
- Implementing binary search trees for efficient searching.
Implementation Details:
- Uses a tree node structure with pointers to left and right children.
- Provides methods for inserting, searching, and traversing nodes.
- Supports various tree traversal algorithms (e.g., in-order, pre-order, post-order).
Definition at line 29 of file Tree.hpp.