Thread
:
How to write the code to delete the whole binary search tree ??
View Single Post
#
2
(
permalink
)
11-23-2007, 11:09 AM
WingedPanther
Join Date: Jul 2006
Age: 35
Posts: 3,238
Last Blog:
wxWidgets is NOT code ...
Credits:
2,668
Rep Power:
36
Basically, in the destructor you need to check both left and right children for NULL, and if not NULL then tell them to delete (which will result in a recursive cascade of freed nodes).
__________________
CodeCall Blog
|
CodeCall Wiki
|
Shareware
|
Linux Forum
Programming is a branch of mathematics.
WingedPanther
View Public Profile
Send a private message to WingedPanther
Find all posts by WingedPanther