void postorder_rec(btnode *root) { if (root == NULL) { // printf("\n"); return; } postorder_rec(root->left); postorder_rec(root->right); printf("%d ", root->val); }
void postorder(std::vector<Key>& l) { postorder_rec(this->root_, l); }
void postorder_rec(BSTNode* p, std::vector<Key>& l) { if (p == nullptr) return; postorder_rec(p->left_, l); postorder_rec(p->right_, l); l.push_back(p->key_); }