TreeUtils is a C++ library that provides a collection of functions for manipulating and analyzing binary trees. The library includes operations for building trees, performing various tree traversals, checking tree balance, counting leaf nodes, verifying identical trees, and more. Additional functions are being added to enhance its capabilities.
- Tree Construction: Functions for building binary trees, including a helper function to build a tree from a level-order traversal.
- Tree Traversals:
- In-order Traversal: Visit left subtree, root, right subtree.
- Pre-order Traversal: Visit root, left subtree, right subtree.
- Post-order Traversal: Visit left subtree, right subtree, root.
- Level-order Traversal: Visit nodes level by level (breadth-first).
- Tree Analysis:
- Balance Checking: Check if a tree is balanced, i.e., the difference between heights of left and right subtrees is not more than 1.
- Leaf Counting: Count the number of leaf nodes in a binary tree.
- Identical Trees: Check if two trees are identical.
- Sum Tree Check: Determine if a tree is a sum tree, where each node's value is the sum of its children's values.
- Height Calculation: Compute the height (or depth) of a tree.
- More tree algorithms and utilities to help with tree-related problems.
- Clone the Repository:
git clone https://github.com/your-username/TreeUtils.git