...

/

Solution Review: Free Tree

Solution Review: Free Tree

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

We'll cover the following...

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