What does the other nodes of an expression tree(except leaves) contain?

Category: QuestionsWhat does the other nodes of an expression tree(except leaves) contain?
Editor">Editor Staff asked 5 months ago

What does the other nodes of an expression tree(except leaves) contain?
 
(a) only operands
 
(b) only operators
 
(c) both operands and operators
 
(d) expression
 
My question is taken from Trees topic in division Trees of Data Structures & Algorithms I
 
I have been asked this question during an interview for a job.

1 Answers
Editor">Editor Staff answered 5 months ago

Correct choice is (b) only operators
 
Best explanation: The nodes other than leaves always contain only operators. There cannot be any operand in those nodes.


Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17
Articles: 40701