History of Idiom 8 > diff from v33 to v34
Edit summary for version 34 by lavi:
[Cpp]
[Cpp]
↷
Version 33
2016-11-28, 22:30:24
Version 34
2016-11-29, 03:15:06
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);
}