I was building a tree to evaluate mathematical expressions containing unary and binary operators, constants and variables with the help of a binary tree.
But I am now facing issues in visualizing how to represent a ternary operation?
Can it be done through a binary tree?
If not do I have any better Data Structure to represent and evaluate the same?
Please comment.
If you’re using (or planning to use) a binary tree, you can make a node with three children by combining two nodes like this: