adding preorder notes and code

This commit is contained in:
Jidong Xiao
2025-03-27 21:19:38 -04:00
committed by JamesFlare
parent 4536070bcd
commit 2e1604f3bd
7 changed files with 76 additions and 15 deletions

View File

@@ -22,12 +22,12 @@ void inorderTraversal(TreeNode* root) {
rightmost->right=current;
current=current->left;
}else{ /* second time */
std::cout << current->val << " ";
std::cout << current->val << " ";
rightmost->right=NULL;
current=current->right;
}
}else{ /* nodes which do not have left child */
std::cout << current->val << " ";
std::cout << current->val << " ";
current=current->right;
}
}