本文整理汇总了C++中postOrder函数的典型用法代码示例。如果您正苦于以下问题:C++ postOrder函数的具体用法?C++ postOrder怎么用?C++ postOrder使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了postOrder函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: postOrder
void postOrder(TreeNodePtr treePtr) {
if (treePtr != NULL) {
postOrder(treePtr->leftPtr);
postOrder(treePtr->rightPtr);
printf("%3d", treePtr->data);
}
}
示例2: postOrder
void postOrder(node* ptr){
if(ptr!=NULL){
postOrder(ptr->left);
postOrder(ptr->right);
printf("%d ",ptr->data);
}
}
示例3: postOrder
void BST<ItemType>::postOrder(TreeNode<ItemType> *t, ofstream &file)
{
if(t == NULL) return;
postOrder(t->right, file);
postOrder(t->left, file);
file << t->element << " ";
}
示例4: postOrder
void BinaryTree<T>::postOrder(BinaryTree<T>* pNode) {
if (pNode == 0)
return;
postOrder(pNode->left);
postOrder(pNode->right);
cout << pNode->data << endl;
}
示例5: postOrder
void postOrder(node *root) {
if (root) {
postOrder(root->left);
postOrder(root->right);
cout << root->data << " ";
}
}
示例6: postOrder
void Solution508::postOrder(TreeNode *root, unordered_map<int, int> &counter, int &maxCount)
{
if (root == nullptr)
return;
if (root->left)
{
postOrder(root->left, counter, maxCount);
root->val += root->left->val;
}
if (root->right)
{
postOrder(root->right, counter, maxCount);
root->val += root->right->val;
}
int count = counter.count(root->val);
if (count == 0)
{
counter.insert({root->val, 1});
count = 1;
} else
count = ++ counter[root->val];
maxCount = std::max(maxCount, count);
}
示例7: postOrder
void postOrder(TreeNode *root, vector<int>& ret) {
if(!root)
return ;
postOrder(root->left, ret);
postOrder(root->right, ret);
ret.push_back(root->val);
}
示例8: postOrder
void postOrder(BSTree *myTree) {
if (myTree) {
postOrder(myTree -> leftChild);
postOrder(myTree -> rightChild);
printf(" %d", myTree -> value);
}
}
示例9: postOrder
void postOrder(node *root) {
if(root != NULL){
postOrder(root->left);
postOrder(root->right);
cout << root->data << ' ';
}
}
示例10: postOrder
void postOrder(struct node *root){
if (root) {
postOrder(root->left);
postOrder(root->right);
printf("%d ", root->key);
}
}
示例11: postOrder
void postOrder(TreeNode *root,DISPLAY display){
if(root != NULL){
postOrder(root->left, display);
postOrder(root->right, display);
display(root->data);
}
}
示例12: postOrder
/**
* print the tree with postorder method
* @param t
*/
void postOrder(tree t) {
if (t) {
postOrder(t->left);
postOrder(t->right);
printf("%d\n", t->elem);
}
}
示例13: postOrder
void postOrder(Node * T)
{
if (T->lchild!=NULL)
postOrder(T->lchild);
if (T->rchild!=NULL)
postOrder(T->rchild);
str[(*size)++]=T->c+'0';
}
示例14: postOrder
void BinaryTree::postOrder(treeNode *root)
{
if(root->leftChild)
postOrder(root->leftChild);
if(root->rightChild)
postOrder(root->rightChild);
std::cout<<root->data<<" ";
}
示例15: postOrder
void postOrder(struct node *n) {
if (n == NULL)
return;
postOrder(n->left);
postOrder(n->right);
printf("%d ", n->key);
}