本文整理汇总了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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例5: deleteTree
//! destructor
COctTreeSceneNode::~COctTreeSceneNode()
{
//if (Mesh)
// Mesh->drop();
deleteTree();
}
示例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;
}
示例7: clean_up
void clean_up(RBTree *tree)
{
if ( tree != NULL )
{
deleteTree(tree);
free(tree);
}
}
示例8: deleteTree
void Lexicon::deleteTree(TrieNode* node) {
if (node != NULL) {
for (char letter = 'a'; letter <= 'z'; letter++) {
deleteTree(node->child(letter));
}
delete node;
}
}
示例9: deleteTree
void Profiler::deleteTree( Node* node )
{
for (auto it = node->children.begin(); it != node->children.end(); ++it)
{
deleteTree(*it);
}
delete node;
}
示例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);
}
}
示例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;
}
}
示例12: deleteTree
void deleteTree(node * root)
{
for(int i=0;i<10;i++)
{
if(root->child[i])
deleteTree(root->child[i]);
}
delete root;
}
示例13: deleteTree
virtual ~BST() {
//Call to clear
deleteTree(root);
//set root equal to nullptr
root = nullptr;
}
示例14: clear
void clear() {
//Delete the tree Post Order Traversal
deleteTree(root);
//Set root to nullptr
root = nullptr;
}
示例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);
}