History of Idiom 8 > diff from v35 to v36
Edit summary for version 36 by programming-idioms.org:
Restored version 33
Restored version 33
↷
Version 35
2016-11-29, 03:15:55
Version 36
2016-11-29, 20:06:34
Idiom #8 Initialize a new map (associative array)
Declare a new map object x, and provide some (key, value) pairs as initial content.
Idiom #8 Initialize a new map (associative array)
Declare a new map object x, and provide some (key, value) pairs as initial content.
Extra Keywords
table dictionary hashExtra Keywords
table dictionary hashCode
#include "BinaryTree.h"
#include <iostream>
using std::cout;
using std::endl;
BinaryTree::BinaryTree()
{
rootNode = NULL;
}
BinaryTree::~BinaryTree()
{
if(rootNode == NULL)
return; // Nothing to do
removeSubtree(rootNode);
}
void BinaryTree::removeSubtree(BinaryTreeNode* x)
{
if(x == NULL)
return; // Nothing to do
BinaryTreeNode* left = x->leftNode;
BinaryTreeNode* right = x->rightNode;
delete x;
removeSubtree(left);
removeSubtree(right);
}