Skip to content

Commit

Permalink
Update inorder-successor-in-bst.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 committed Sep 22, 2015
1 parent 169841a commit 1fff0ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion C++/inorder-successor-in-bst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Solution {
public:
TreeNode* inorderSuccessor(TreeNode* root, TreeNode* p) {
// If it has right subtree.
if (p->right) {
if (p && p->right) {
p = p->right;
while (p->left) {
p = p->left;
Expand Down

0 comments on commit 1fff0ea

Please sign in to comment.