...

/

Solution Review: Free Tree

Solution Review: Free Tree

Let's discuss in detail how to empty a binary tree.

Solution

For this problem, we point the root of the tree to null. This way, the memory of tree nodes is automatically freed using garbage collection. ...