An expression tree’s nodes can be deleted by calling?

Category: QuestionsAn expression tree’s nodes can be deleted by calling?
Editor">Editor Staff asked 1 month ago

An expression tree’s nodes can be deleted by calling?
 
(a) malloc
 
(b) calloc
 
(c) delete
 
(d) free
 
Origin of the question is Trees topic in division Trees of Data Structures & Algorithms I
 
I have been asked this question in examination.

1 Answers
Editor">Editor Staff answered 1 month ago

Right answer is (d) free
 
Easiest explanation – In Binary trees, nodes are created by calling malloc and they are deleted by calling free.