Closed Beakerboy closed 1 year ago
Patch coverage: 100.00
% and no project coverage change.
Comparison is base (
34e52f6
) 100.00% compared to head (0ff5b47
) 100.00%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
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.
This looks good and I'm fine with questions in PRs! Sorry for the slow response - I had a bunch of work pile up.
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:
__len__(self)
and use that as the public facing interface? Internally,self._size
Would still work.preorder()
etc methods using an optional method parameter.__lt__()
,__gt__()
, etc and ask ifnode1 > node 2
instead ofnode1.item > node2.item