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 4 weeks 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 4 weeks 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.