• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ deleteTree函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: deleteTree

KDTree & KDTree::operator=(const KDTree &other) {
    if(this != &other) {
        deleteTree(this->root);
        this->root = copyTree(other.root);
        this->bounds = other.bounds;
    }

    return *this;
}
开发者ID:blargg,项目名称:ray-based-graphics,代码行数:9,代码来源:kdtree.cpp


示例17: pmsBP_C

// compute the cdf given a tree
void pmsBP_C(double *weights, double * grid, int * ngrid, int *maxS, double * out, int *log_p)
{
	struct bintree *w = new struct bintree;
	setTree(1.0, w);
	//struct bintree *w = newtree(1);
	array2tree(weights, maxS[0], w);
	pmsBP(w, out, grid, ngrid, log_p);
	deleteTree(w);
}
开发者ID:cran,项目名称:msBP,代码行数:10,代码来源:wrapper.cpp


示例18: rsample_msBP_C

// random sample from a msBP density
void rsample_msBP_C(int *N, double * Rvec, double *Svec, double *a, double *b, int * maxS, double *ans)
{
	int i = 0;	
	struct bintree * Stree = new struct bintree;
	struct bintree * Rtree = new struct bintree;
	setTree(1.0, Stree);
	setTree(1.0, Rtree);
	//struct bintree *Stree = newtree(1);
	//struct bintree *Rtree = newtree(1);
	array2tree(Svec, maxS[0], Stree);
	array2tree(Rvec, maxS[0], Rtree);
	for(i=0; i<N[0]; i++)
	{
		ans[i] = rsample_msBP(Rtree,Stree,a[0],b[0]);
	}
	deleteTree(Rtree);
	deleteTree(Stree);
}
开发者ID:cran,项目名称:msBP,代码行数:19,代码来源:wrapper.cpp


示例19: computeprob_C

// compute the weigths given a tree 
void computeprob_C(double *S, double * R, int *maxS, double *a, double *b, double *ans, int *root)
{
	struct bintree *Stree = new struct bintree;
	struct bintree *Rtree = new struct bintree;
	setTree(1.0, Stree);
	setTree(1.0, Rtree);
///	struct bintree *Stree = newtree(1);
//	struct bintree *Rtree = newtree(1);
//	struct bintree *anstree = newtree(1);
	if(root[0]==0) S[0] = 0;
	array2tree(S, maxS[0], Stree);
	array2tree(R, maxS[0], Rtree);
	struct bintree *anstree = computeprob(Stree, Rtree, a[0], b[0], maxS[0], 1);
	tree2array(anstree, ans, maxS[0], 0);
	deleteTree(Stree);
	deleteTree(Rtree);
	deleteTree(anstree);
} 
开发者ID:cran,项目名称:msBP,代码行数:19,代码来源:wrapper.cpp


示例20: postCluster_C

//compute the posterior cluster allocation with slice sampler [Algorithm 2]
void postCluster_C(int *s, int *h, double *y, double *pi, int *maxS, int *N, int *printscreen)
{
	struct bintree *pitree = new struct bintree;
	setTree(1.0, pitree);
	//struct bintree *pitree = newtree(1);
	array2tree(pi, maxS[0], pitree);
	postCluster(s, h, y, pitree, *maxS, *N, *printscreen);
	deleteTree(pitree);
} 
开发者ID:cran,项目名称:msBP,代码行数:10,代码来源:wrapper.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ delete_area函数代码示例发布时间:2022-05-30
下一篇:
C++ deleteToken函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap