Skip to content

Conversation

@yulianka
Copy link
Contributor

Closes #174.

@yulianka yulianka requested a review from miorel as a code owner August 12, 2024 11:42
Copy link
Contributor

@miorel miorel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 🙏

yield node
continue

if node.right:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, I think to the extent that the code remains idiomatic, it would be nice to have consistency across languages. I think so far in TypeScript and Java we've allowed nulls to be added to the stack. The advantage of that style is that there is only one if statement instead of 3. The advantage of this style is that, well, no nulls/Nones in the stack.

I'd probably still prefer the style with only one if statement because we repeat ourselves less, but if you're advocating for this style then we should change the Java and TypeScript code to stay consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miorel I can see your point, with the TS tree traversal style we do not repeat the same code twice. I modified the code.

@yulianka yulianka requested a review from miorel August 13, 2024 16:04
@yulianka yulianka merged commit 430bc86 into code-chronicles-code:main Aug 14, 2024
@yulianka yulianka deleted the python-traverse-inorder branch August 14, 2024 09:42
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.

Add Python goody for traversing a binary tree in-order

2 participants