本文整理汇总了C++中destroyTree函数的典型用法代码示例。如果您正苦于以下问题:C++ destroyTree函数的具体用法?C++ destroyTree怎么用?C++ destroyTree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了destroyTree函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: destroyTree
void exprTree::destroyTree(Node *leaf) {
if (leaf != nullptr) {
destroyTree(leaf->left);
destroyTree(leaf->right);
delete leaf;
}
}
开发者ID:LaurenceGA,项目名称:programmingProjects,代码行数:7,代码来源:extree.cpp
示例2: so
/*prints all the files associated with any word*/
int so(char *str, hashTable *ht) {
char *word;
FileNode *fptr; /* Iterates through filenames */
if (strcmp(strtok(str, " "), "so") != 0) {
printf("I did not get 'so' inside sa function!!\n");
return 1;
}
/* goes through each word in input */
while ((word = strtok(NULL, " "))) {
for (ptr = getFiles(word, root); ptr != NULL;
ptr = ptr->next) {
insert_to_list(t, ptr->filename);
}
}
/* Means we got no matches */
if (t->files == NULL) {
printf("No matches found.\n");
destroyTree(t);
return 1;
}
/* prints all the filenames */
for (ptr = t->files; ptr->next != NULL; ptr = ptr->next)
printf("%s, ", ptr->filename);
if (ptr)
printf("%s\n", ptr->filename);
destroyTree(t);
return 0;
}
开发者ID:darthvader1118,项目名称:iLab-stuff,代码行数:34,代码来源:saso.c
示例3: destroyTree
void Node::destroyTree(Node *a) {
if (a != NULL)
{
destroyTree(a->left);
destroyTree(a->right);
delete a;
}
};
开发者ID:Themiak,项目名称:SDiZO,代码行数:8,代码来源:L4.cpp
示例4: destroyTree
void destroyTree(node *in){
if(in != 0){
destroyTree(in->left);
destroyTree(in->right);
free(in);
}
}
开发者ID:scarter93,项目名称:Data-Structures,代码行数:8,代码来源:binarySearchTree.c
示例5: destroyTree
void destroyTree(struct tree* victim){
if(victim->son1)
destroyTree(victim->son1);
if(victim->son2)
destroyTree(victim->son2);
free(victim);
victim = 0;
}
开发者ID:awarematics,项目名称:SECONDO,代码行数:8,代码来源:Tree.c
示例6: destroyTree
void destroyTree(NodePtr leaf) {
if(leaf != nullptr) {
destroyTree(leaf->left);
destroyTree(leaf->right);
delete leaf;
--numberOfNodes;
}
}
开发者ID:gregvw,项目名称:data-structures,代码行数:8,代码来源:bst.hpp
示例7: bipartGraphDestroy
void bipartGraphDestroy(bpGraph_t* pGraph)
{
/* TODO: Implement me! */
destroyTree(pGraph->vpVertsP1);
destroyTree(pGraph->vpVertsP2);
safeFree(pGraph, sizeof(bpGraph_t));
pGraph = NULL;
} /* end of bipartGraphDestroy() */
开发者ID:j1nhu,项目名称:Bipartite-Graph,代码行数:8,代码来源:bpGraphAdjList_BL.c
示例8: destroyTree
//--------------------------------------------------------------------------
// void destroyTree(BSTNode* subTreePtr);
// Taken from Carrano et al.: method used to destruct a BST
// Preconditions: BST exists
// Postconditions: BST is destructed
// Return value: None
// Functions called: Recursive call to itself
void BST::destroyTree(BSTNode* subTreePtr) {
if (subTreePtr != nullptr)
{
destroyTree(subTreePtr->left);
destroyTree(subTreePtr->right);
delete subTreePtr;
}
}
开发者ID:kestemm,项目名称:work_examples,代码行数:15,代码来源:BST.cpp
示例9: destroyTree
void destroyTree(HuffNode * tree)
/*This function deallocates the memory allocated by the Huffman tree.*/
{
if(tree == NULL){return;}//base case:reach the leaf of the tree, return to free the leaf
destroyTree(tree -> left);//check all the left children
destroyTree(tree -> right);//check all the right children
free(tree);//free the memory of the tree
}
开发者ID:kibazhang,项目名称:C_Programming_Related,代码行数:8,代码来源:helper.c
示例10: destroyTree
//Deallocates memory for the given root and all its subtrees
//O(h)
void destroyTree(struct tree *root){
//Since this is a tree, we can use post order recursion to recusrivley delete all the nodes in the left and right subtree then the root
if(root!=NULL){
destroyTree(root->left);
destroyTree(root->right);
free(root);
}
}
开发者ID:maxabrams,项目名称:Huffman-Coding,代码行数:11,代码来源:tree.c
示例11: destroyTree
// Private destroyTree function. It will delete all the nodes of the tree
void BinaryTree::destroyTree(TreeNode *leaf)
{
if(leaf!=NULL)
{
destroyTree(leaf->left);
destroyTree(leaf->right);
delete leaf;
}
}
开发者ID:et2372584,项目名称:EdgarTrujilloSanchez_CSC17C_48942,代码行数:10,代码来源:BinaryTree.cpp
示例12: bipartGraphDestroy
void bipartGraphDestroy(bpGraph_t* pGraph)
{
/* Destroy each partite tree */
destroyTree(*pGraph->vertices1);
destroyTree(*pGraph->vertices2);
/* Free the graph struct */
safeFree(pGraph, sizeof(pGraph));
} /* end of bipartGraphDestroy() */
开发者ID:S4KH,项目名称:algo-analyse,代码行数:9,代码来源:bpGraphAdjList_BL.c
示例13: destroyTree
void LinkedBinaryTree<T>::destroyTree(Node* p) {
if (p != NULL) {
destroyTree(p->left);
destroyTree(p->right);
delete p;
}
}
开发者ID:ingamelkerte,项目名称:GoodrichTamassiaCpp,代码行数:9,代码来源:linkedTree.hpp
示例14: destroyTree
void BinaryNodeTree<ItemType>::destroyTree(BinaryNode<ItemType>* subTreePtr)
{
if (subTreePtr != nullptr)
{
destroyTree(subTreePtr->getLeftChildPtr());
destroyTree(subTreePtr->getRightChildPtr());
delete subTreePtr;
} // end if
} // end destroyTree
开发者ID:kylienic,项目名称:CTP-250,代码行数:9,代码来源:BinaryNodeTree.cpp
示例15: destroyTree
void BST::destroyTree(TreeNode *& treePtr)
{
// postorder traversal
if (treePtr != NULL)
{ destroyTree(treePtr->leftChildPtr);
destroyTree(treePtr->rightChildPtr);
delete treePtr;
treePtr = NULL;
} // end if
} // end destroyTree
开发者ID:elisemmc,项目名称:EECS268,代码行数:10,代码来源:BST.cpp
示例16: destroyTree
void destroyTree(TreeNode * tn)
{
if (tn == NULL)
{
return;
}
destroyTree(tn -> left);
destroyTree(tn -> right);
free(tn);
}
开发者ID:paulkrog,项目名称:R_Solutions,代码行数:10,代码来源:utility.c
示例17: destroyTree
void destroyTree(node_t* root)
{
//free all node
if (root)
{
destroyTree(root->left);
destroyTree(root->right);
free(root);
}
}
开发者ID:NaiveRed,项目名称:NDHU-Data-Structure-Course,代码行数:10,代码来源:BinaryTree.c
示例18: destroyTree
void destroyTree(BinaryTreeNode* root)
{
if(root)
{
destroyTree(root->m_pLeft);
destroyTree(root->m_pRight);
delete root;
root = 0;
}
}
开发者ID:MarsZhuJin,项目名称:microsoft-interview-100,代码行数:10,代码来源:weiruan_4.cpp
示例19: bipartGraphDestroy
void bipartGraphDestroy(bpGraph_t* pGraph)
{
/* this function checks for NULL */
destroyTree(pGraph->adjTreeP1);
destroyTree(pGraph->adjTreeP2);
safeFree(pGraph->vertExistsP1, pGraph->numVertsP1 * sizeof(char));
safeFree(pGraph->vertExistsP2, pGraph->numVertsP2 * sizeof(char));
safeFree(pGraph, sizeof(bpGraph_t));
} /* end of bipartGraphDestroy() */
开发者ID:JoshuaRichards,项目名称:aaA1,代码行数:11,代码来源:bpGraphAdjList_BL.c
示例20: destroyTree
//----------------------------------------------------------------------------
// DestroyTree
// postorder deletion of nodes in the tree
// @param tree current node passed into recursive function
//
void BinTree::destroyTree(Node*& tree){
if (tree != NULL){
destroyTree(tree->left); //destroy left
destroyTree(tree->right); //destroy right
delete tree->movie; //delete NodeData
tree->movie = NULL;
delete tree; //Delete Node
tree = NULL;
}
} //end destroyTree
开发者ID:tazzledazzle,项目名称:UW-CSS,代码行数:16,代码来源:bintree.cpp
注:本文中的destroyTree函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论