Skip to content

Conversation

OOCZC
Copy link

@OOCZC OOCZC commented Aug 6, 2018

while(rootInorder <= endInorder && *rootInorder != rootValue)
    ++ rootInorder;

if(rootInorder == endInorder && *rootInorder != rootValue)
    throw std::exception("Invalid input.");

rootInorder == endInorder && *rootInorder != rootValue时会继续++ rootInorder;,此时应该为无效输入,缺不能符合rootInorder == endInorder的判断条件。

则修改为:
while(rootInorder < endInorder && *rootInorder != rootValue)
++ rootInorder;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant