Skip to content

Fix falsy-zero bug in BST validation, deduplicate TreeNode#2742

Merged
keon merged 2 commits intomainfrom
fix/treenode-dedup-falsy-zero
Mar 13, 2026
Merged

Fix falsy-zero bug in BST validation, deduplicate TreeNode#2742
keon merged 2 commits intomainfrom
fix/treenode-dedup-falsy-zero

Conversation

@keon
Copy link
Copy Markdown
Owner

@keon keon commented Mar 12, 2026

Summary

Test plan

  • python -m pytest tests/test_tree.py -x -q — 11 tests pass
  • BST validation now correctly handles trees with node value 0
  • No duplicate class TreeNode in changed files

Closes #2725, #2732

🤖 Generated with Claude Code

keon and others added 2 commits March 12, 2026 11:08
- Fix bst_validate_bst.py: replace all truthiness checks on min/max
  values with explicit `is not None` checks, fixing incorrect results
  for BSTs containing 0 (#2732)
- Replace local TreeNode class definitions with imports from
  algorithms.common.tree_node in 4 compatible tree files (#2725)

Closes #2725, closes #2732

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@keon keon merged commit 8fed83a into main Mar 13, 2026
4 checks passed
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.

Deduplicate TreeNode — use common/tree_node.py instead of local redefinitions

1 participant