1234567891011121314151617181920
void preOrder(BSTNode* root) { queue<BSTNode*> Pre; Pre.push(root); while(!Pre.empty()) { BSTNode *root = Pre.front(); Pre.pop(); if(root!= NULL) { Pre.push(root->left); Pre.push(root->right); cout << root->value << " "; } } }