Example #1
0
void Map<Key,Value>::recCopy(Node<Key,Value> &n){
  if(n==nullptr) return;

  recCopy(*(n.getLeft()));
  bst.insert(new std::pair<Key, Value>(n.getKey(), n.getValue()));
  recCopy(*(n.getRight()));
  
}
Example #2
0
areaTreeNode * AreaTree::recCopy( const areaTreeNode * at )
{	if( at == NULL )
		return NULL;
	areaTreeNode * node = new areaTreeNode(at->areaID, at->area );
	node->left = recCopy( at->left );
	node->right = recCopy( at->right );
	return node;
}
Example #3
0
Map<Key, Value>::Map(const Map<Key, Value>& m){
  BST<Key, Value> copy = m.bst;
  
  if(map == this) return;

  if(bst != nullptr) delete bst;
  bst = new BST<Key,Value>();
  
  recCopy(*((m.bst)->root));

}
Example #4
0
AreaTree::AreaTree( const AreaTree & at )
{	root = recCopy( at.root );	
}