indentation
This commit is contained in:
@@ -88,11 +88,11 @@ void preorderTraversal(TreeNode* root) {
|
|||||||
while(rightmost->right!=nullptr && rightmost->right!=current){
|
while(rightmost->right!=nullptr && rightmost->right!=current){
|
||||||
rightmost=rightmost->right;
|
rightmost=rightmost->right;
|
||||||
}
|
}
|
||||||
if(rightmost->right==nullptr){ /* first time */
|
if(rightmost->right==nullptr){ /* visiting the right most node for the first time */
|
||||||
std::cout << current->val << " ";
|
std::cout << current->val << " ";
|
||||||
rightmost->right=current;
|
rightmost->right=current;
|
||||||
current=current->left;
|
current=current->left;
|
||||||
}else{ /* second time */
|
}else{ /* visiting the right most node for the second time */
|
||||||
rightmost->right=nullptr;
|
rightmost->right=nullptr;
|
||||||
current=current->right;
|
current=current->right;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user