How ahmedmhedhbii/tree-evaluation works
This repository implements a space-efficient evaluation algorithm for complete binary trees, with both C++ and Python versions. In the C++ command-line workflow, a user supplies the tree height, alphabet, function table, and leaf values; initialization builds the finite field and register state, the clean computation evaluates the root, and a naive evaluator checks the result before it is printed. The recursive algorithm uses forward and inverse register computations and polynomial terms. The Python implementation is a standalone alternative. The graph reflects the shown C++ calls and documented Python capability; it does not infer links between the two implementations.
Main entry points: main.cpp CLI Entry · algorithm.cpp Forward Recursion · tree.py Python Implementation · galois_field.cpp Field Arithmetic
Components 13
C++ Command Line
- CLI Entry
src/main.cpp - Printed Result
src/main.cpp
Tree Evaluation
- Parameter Input
src/algorithm.cpp - Field Setup
src/algorithm.cpp - Clean Computation
src/algorithm.cpp - Forward Recursion
src/algorithm.cpp - Inverse Recursion
src/algorithm.cpp - Polynomial Terms
src/algorithm.cpp - Naive Evaluation
src/algorithm.cpp
Finite Field
- Field Arithmetic
src/galois_field.cpp - Field Representation
include/galois_field.hpp
Python Alternative
- Python Implementation
proto/tree.py
Other components
- User
Connections 14
- User → CLI Entry: starts
README.md - CLI Entry → Parameter Input: initializes parameters
src/main.cpp - Parameter Input → Field Setup: creates field
src/algorithm.cpp - Field Setup → Field Representation: constructs
src/algorithm.cpp - Parameter Input → Field Arithmetic: creates field elements
src/algorithm.cpp - CLI Entry → Clean Computation: runs
src/main.cpp - Clean Computation → Forward Recursion: invokes
src/algorithm.cpp - Forward Recursion → Inverse Recursion: invokes
src/algorithm.cpp - Inverse Recursion → Forward Recursion: invokes
src/algorithm.cpp - Forward Recursion → Polynomial Terms: computes terms
src/algorithm.cpp - Inverse Recursion → Polynomial Terms: computes terms
src/algorithm.cpp - CLI Entry → Naive Evaluation: checks result
src/main.cpp - CLI Entry → Printed Result: prints
src/main.cpp - Python Implementation → Python Implementation: offers standalone workflow
README.md