コード例 #1
0
ファイル: BST.cpp プロジェクト: coolaj86/fizzbuzz
	//!  Copy method.  Makes a complete copy of its argument
	void BST::Copy(const BST & other)
	{
		if (this == &other)
			return;
		
		size = other.GetSize();	
		if(other.root)
			root = (new BSTNode(*(other.root)));
		else
			root=NULL;
		
		return;
	}
コード例 #2
0
ファイル: main.cpp プロジェクト: B0bTh3BuiIder/cs240
int main(){
    LinkedList tList = LinkedList();

	char* c = new char[3];
	c[1] = '\n';
	c[2] = '\0';

    for(int i = 0; i < 200000; i++){
    	c[0] = (char)i;
    	tList.Insert(c, NULL);
    }

	tList = tList;
	cout << "LinkedList contents:" << tList.GetSize() << endl;
    //tList->Output(cout);

    //tList->Clear();
    LinkedList tNew = tList;
    //tList->Clear();

    cout << endl << endl << "List Copy contents:" << tNew.GetSize() << endl;
	//tNew.Output(cout);

    BST* tBST = new BST();
    BSTNode* tBSTNode;

    tBSTNode = tBST->Insert("Cool\n");
    tBSTNode = tBST->Insert("Awesome\n");
    tBSTNode = tBST->Insert("Test\n");
    tBSTNode = tBST->Insert("1\n");
    //tBST->Remove(tBSTNode);
    tBSTNode = tBST->Insert("4\n");
    tBSTNode = tBST->Insert("2\n");
    tBSTNode = tBST->Insert("3\n");

    cout << endl << endl << "BST contents:" << tBST->GetSize() << endl;
    tBST->Output(cout, tBST->GetRoot());


    delete tBST;
}