Skip to content

Add utility functions to traverse trees to find minimum, maximum node and the keys adjacent to a node #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 26, 2025

Conversation

souma4
Copy link
Contributor

@souma4 souma4 commented Feb 23, 2025

Based on the discussions in #12 and #1168. This adds utility functions to compute the minimum and maximum values within subtrees (or a whole tree), and a function to find the nodes adjacent to a given node.

Current open Q's from me
A. the @inferred tests give errors because the inferred type is a union type, but the output types are either a union type or only the node types depending on the exact call.
B. handling nothing types in above below. I can see adding a method for tree::nothing, x::nothing too, but this seems like a good start.

…s within the tree and within subtrees, and an abovebelow function that returns the nodes immediately above and below a given BinaryNode
…o accepts the key, functions like an advanced search now. fixed tests using @inferred Nothing.
@codecov-commenter
Copy link

codecov-commenter commented Feb 24, 2025

Codecov Report

Attention: Patch coverage is 89.28571% with 3 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@5e89b74). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/binarytree.jl 89.28% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #13   +/-   ##
=======================================
  Coverage        ?   97.59%           
=======================================
  Files           ?        3           
  Lines           ?      166           
  Branches        ?        0           
=======================================
  Hits            ?      162           
  Misses          ?        4           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@juliohm juliohm left a comment

Choose a reason for hiding this comment

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

The PR looks great. Just a few suggestions and updates to comments in source code.

@eliascarv please feel free to give the final review and merge when you feel it is ready.

…Type to the full type (using their subset rule). Let me know if there's a better alternative
@eliascarv eliascarv requested a review from juliohm February 26, 2025 21:31
@souma4 souma4 force-pushed the JRC_min_max_abovebelow branch from bb70a51 to 1e9a292 Compare February 26, 2025 21:31
@eliascarv
Copy link
Collaborator

You can now give your final review @juliohm.

@juliohm
Copy link
Collaborator

juliohm commented Feb 26, 2025

@eliascarv feel free to merge and release a patch. If you can add me as collaborator in this repository as well, that would be great.

@eliascarv eliascarv merged commit 98603c7 into JuliaCollections:main Feb 26, 2025
3 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.

4 participants