Is there a reasonable way to make an entire Computer Algebra System (algebraic equations, limits, derivatives, integrals) without using binary trees?
1 Answers
Maple uses a Directed acyclic graph (DAG). The is still a tree-like structure with nodes and links however two nodes can have the same child if they have common subexpressions. Binary trees are a special case of DAG's which are a special type of graph.
Binary trees are actually a bit restrictive. You often want to have a different number of children for each node: unitary operators like -x, functions with various numbers of arguments. An integral will need four children: the integrand, top and bottom limits and the variable the integral is wrt.
If you know your elements are going to be of a specific type then other data types might be more appropriate. For example if you are dealing with polynomials then multidimensional arrays might be more appropriate. So 2 x^2 + 3 x - 7 might be represented as [7,3,2].
For a general purpose system I don't think you could get away from some graph like structure.

- 7,536
- 2
- 32
- 38