当前位置: 首页>>代码示例>>C++>>正文


C++ deleteTree函数代码示例

本文整理汇总了C++中deleteTree函数的典型用法代码示例。如果您正苦于以下问题:C++ deleteTree函数的具体用法?C++ deleteTree怎么用?C++ deleteTree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了deleteTree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: deleteTree

/*!
 * \brief Cleans up the object and frees up memory used by the solution tree.
 * \param processEvents If set to \c true then \link QCoreApplication::processEvents() QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents)\endlink will be called from time to time while cleaning up.
 * \warning After call to this function a solution tree returned by the solve() function is no longer valid.
 * \note It is not required to call this function manually. This function is always called by solve() at the beginning of the solution process.
 *
 * \sa solve(), setCleanupOnCancel()
 */
void CTSPSolver::cleanup(bool processEvents)
{
    route.clear();
    mayNotBeOptimal = false;
    if (root != NULL)
        deleteTree(root, processEvents);
}
开发者ID:paulcdejean,项目名称:tspsg,代码行数:15,代码来源:tspsolver.cpp

示例2: mathexpr_create

MathExpr * mathexpr_create(char *formula, int (*getVar) (char *))
{
    ExprTree *tree;
    MathExpr *expr = NULL;
	MathExpr *result = NULL;
    getVariableIndex = getVar;
    Err = 0;
    PrevLex = 0;
    CurLex = 0;
    S = formula;
    Len = strlen(S);
    Pos = 0;
    Bc = 0;
    tree = getTree();
    if (Bc == 0 && Err == 0)
	{
		traverseTree(tree, &expr);
		while (expr)
		{
			result = expr;
			expr = expr->prev;
		}
	}
	deleteTree(tree);
    return result;
}
开发者ID:christianurich,项目名称:DynaMind-GDALModules,代码行数:26,代码来源:mathexpr.c

示例3: sortHelper

//traverse list inorder and add elements to the array
int BST::sortHelper(TreeItemType a[], int i, TreeNode* t)
{
	TreeNode* curr = t;
        TreeItemType x;

        if(t->leftChildPtr != NULL)
        {
            curr = curr->leftChildPtr;
            sortHelper(a,i,curr);
        }

        x = curr->item;
        a[i] = x;
	i++;

        if(t->rightChildPtr != NULL)
        {
            curr = curr->rightChildPtr;
            sortHelper(a,i,curr);
        }
	if(i == (size() - 1))
	{
	    int j,k;
	    deleteTree(root);
	    j = sizeof(a);
	    k = ceil(j/2);

		buildHelper(a,k,0,j-1,root);
	}
}
开发者ID:haydenx83,项目名称:School,代码行数:31,代码来源:BST.cpp

示例4: deleteTree

/*
void MovieTree::deleteTree(Movie*)

Description:
Private, recursive function called in the destructor to properly deallocate
memory used by the tree.

Precondition:
The ends of the tree are nil.

Postcondition:
Each movie in the tree is deleted, using post-order traversal.
*/
void MovieTree::deleteTree(Movie *m)
{
    if (m == nil) {
        return;
    }

    if (m->left != nil) {
        deleteTree(m->left);
    }

    if (m->right != nil) {
        deleteTree(m->right);
    }

    delete m;
}
开发者ID:AdamEParnes,项目名称:Anderson_CSCI2270_FinalProject,代码行数:29,代码来源:MovieTree.cpp

示例5: deleteTree

//! destructor
COctTreeSceneNode::~COctTreeSceneNode()
{
	//if (Mesh)
	//	Mesh->drop();

	deleteTree();
}
开发者ID:John-He-928,项目名称:krkrz,代码行数:8,代码来源:COctTreeSceneNode.cpp

示例6: main

main()
{
	struct node *T;
	root =NULL;
	T=root;
	insert(root,5);
	insert(root,9);
	insert(root,4);
	insert(root,5);
	insert(root,2);
	insert(root,2);
	insert(root,7);

	traverseAndDisplay(root);

	deleteNode(root,5);
	traverseAndDisplay(root);
	
	deleteNode(root,2);
	traverseAndDisplay(root);

	deleteTree(root);
	traverseAndDisplay(root);
	return 0;
}
开发者ID:Metas,项目名称:ZTA,代码行数:25,代码来源:ZillowTrinaryTreeCode.c

示例7: clean_up

void clean_up(RBTree *tree)
{
  if ( tree != NULL )
  {
    deleteTree(tree);
    free(tree);
  }
}
开发者ID:Mithrandir0x,项目名称:so2,代码行数:8,代码来源:practica4.c

示例8: deleteTree

void Lexicon::deleteTree(TrieNode* node) {
    if (node != NULL) {
        for (char letter = 'a'; letter <= 'z'; letter++) {
            deleteTree(node->child(letter));
        }
        delete node;
    }
}
开发者ID:chuzui,项目名称:courses,代码行数:8,代码来源:lexicon.cpp

示例9: deleteTree

void Profiler::deleteTree( Node* node )
{
	for (auto it = node->children.begin(); it != node->children.end(); ++it)
	{
		deleteTree(*it);
	}
	delete node;
}
开发者ID:galek,项目名称:GraphicsDemo,代码行数:8,代码来源:profiler.cpp

示例10: deleteTreeAr

	static void deleteTreeAr( std::vector<TreeNode*>& ar)
	{
		std::vector<TreeNode*>::iterator ai = ar.begin(), ae = ar.end();
		for (; ai != ae; ++ai)
		{
			deleteTree( *ai);
		}
	}
开发者ID:patrickfrey,项目名称:strusStream,代码行数:8,代码来源:testRandomExpressionTreeMatch.cpp

示例11: deleteTree

void deleteTree(treenode_t ** root_ptr) {
    if (*root_ptr == NULL) {
        return;
    }
    else {
        // go left first
        deleteTree(&(*root_ptr)->left);

        // go right second
        deleteTree(&(*root_ptr)->right);

        // delete root
        (*root_ptr)->left = NULL;
        (*root_ptr)->right = NULL;
        free (*root_ptr);
        (*root_ptr) = NULL;
    }
}
开发者ID:akonecki,项目名称:CodingProjects,代码行数:18,代码来源:memory.c

示例12: deleteTree

void deleteTree(node * root)
{
	for(int i=0;i<10;i++)
	{
		if(root->child[i])
			deleteTree(root->child[i]);
	}
	delete root;
}
开发者ID:KedarBiradar,项目名称:Problem-Solving,代码行数:9,代码来源:PHONELST.cpp

示例13: deleteTree

  virtual ~BST() {

    //Call to clear
    deleteTree(root);

    //set root equal to nullptr
    root = nullptr;

  }
开发者ID:Elblonko,项目名称:CSE100,代码行数:9,代码来源:BST.hpp

示例14: clear

 void clear() {
   
     //Delete the tree Post Order Traversal
     deleteTree(root);
   
     //Set root to nullptr
     root = nullptr;
   
 }
开发者ID:Elblonko,项目名称:CSE100,代码行数:9,代码来源:BST.hpp

示例15: assert

void KDTree::rebuildTree(vector<Drawable *> objList) {
    assert(objList.size() > 0);

    deleteTree(this->root);
    root = new KDNode;
    root->objects = objList;
    bounds = findBounds(objList);
    buildTree(root, bounds, 0);
}
开发者ID:blargg,项目名称:ray-based-graphics,代码行数:9,代码来源:kdtree.cpp


注:本文中的deleteTree函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。