2 answers
Best answer
Binary tree is a finite set of elements called nodes such that is
It may be empty or it is partitioned into three disjoint subsets there is a single distinguished element called the root of tree others two subsets are binary tree called left subtree and right subtree
E= (a+b)/ [(c*d)-e]

- Thankyou for solving this question E= (a+b)/ [(c*d)-e]
Answer: A binary tree is a finite set of nodes that is either empty or has a root with a left and a right subtree, each of which is itself a binary tree. For \(E = (a+b)/[(c*d)-e]\) the root is "/".
Definition: A binary tree T is a finite set of elements called nodes such that either T is empty, or T contains a distinguished node R called the root, and the remaining nodes form an ordered pair of disjoint binary trees called the left subtree and the right subtree of R. Each node has at most two children.
Expression tree: The operator applied last becomes the root. Here the division is done last, so "/" is the root; its left operand is \(a+b\) and its right operand is \((c*d)-e\).
/
/ \
+ -
/ \ / \
a b * e
/ \
c d
Operators are internal nodes and the variables a, b, c, d, e are leaves. Check: the inorder traversal gives back \((a+b)/((c*d)-e)\).
Your answer
Log in or create a free account to answer this question.