I am stupid..... this is a MS interview question.
Pseudo code
void printNode(root) {
if(!root) return;
stack<Node*> nodes;
Node* pCurrent;
while(!pCurrent || !nodes.empty()) {
if(pCurrent) {
nodes.push(pCurrent);
Node* tmp = nodes.top();
if(tmp->val < small) {root = NULL;}
else {
pCurrent = pCurrent->left;
}
} else {
Node* top = stack.top();
stack.pop();
if(top->val >= small && top->val <= big) cout << top->val << endl;
if(top->val > big) pCurrent = NULL;
else pCurrent = top->right;
}
}
}