emilydolson / python-red-black-trees

Red-black tree implementation in Python
Other
20 stars 5 forks source link

Modified traversing printers to Iterable creators. Created null node factory. #4

Closed Beakerboy closed 1 year ago

Beakerboy commented 1 year ago

This PR changes method signatures, but does not break any tests. Instead of printing the tree, the preorder, etc method create an array in the specified order, which can be used for anything

Also created the __iter__() method.

instead of defining a null node within the RedBlackTree class, I moved to the Node class as a class method.

Let me know if you want anything tweaked.

All the next PRs I plan on submitting will be fully breaking tests. For example, I want to make the attributes private and create more setters and getters.

Questions for the next set of changes:

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (34e52f6) 100.00% compared to head (0ff5b47) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #4 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 1 1 Lines 290 324 +34 ========================================= + Hits 290 324 +34 ``` | [Impacted Files](https://codecov.io/gh/emilydolson/python-red-black-trees/pull/4?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Emily+Dolson) | Coverage Δ | | |---|---|---| | [src/rbtree.py](https://codecov.io/gh/emilydolson/python-red-black-trees/pull/4?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Emily+Dolson#diff-c3JjL3JidHJlZS5weQ==) | `100.00% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Emily+Dolson). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Emily+Dolson)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

Beakerboy commented 1 year ago

Let me know if you want me to split this PR up into smaller units which would be faster to review.

Also, no need to answer my questions, they are just my ideas moving forward. If you have no strong opinions I can just do what I feel is most appropriate. If you turn on the discussions feature, I can post questions there instead of on a PR. Let me know what you prefer.

emilydolson commented 1 year ago

This looks good and I'm fine with questions in PRs! Sorry for the slow response - I had a bunch of work pile up.