Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

if there is binary tree which one is the easiest way to
delete all child node?

Answer Posted / q

class BinaryTreeNode
{
BinaryTreeNode *left,*right;
public:

//....

//....
~BinaryTreeNode()
{
if(left) delete left;
if(right) delete right;
}

};

delete root, all child nodes will be deleted recusively...

Is This Answer Correct ?    11 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain some examples of operator overloading?

1133


Write some differences between an external iterator and an internal iterator? Describe the advantage of an external iterator.

1091


What are the four partitions in which c++ compiler divides the ram?

1241


What are the steps in the development cycle?

1112


What is static class data?

1070


Briefly describe a B+ tree. What is bulk loading in it?

1353


When must you use a pointer rather than a reference?

1049


Can a built-in function be recursive?

1032


What is searching? Explain linear and binary search.

1003


Difference between a homogeneous and a heterogeneous container

1152


Which bit wise operator is suitable for checking whether a particular bit is on or off?

1043


Which should be more useful: the protected and public virtuals?

1054


Explain stack & heap objects?

1066


Should the member functions which are made public in the base class be hidden?

1038


How can an improvement in the quality of software be done by try/catch/throw?

1075