Skip to content
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

Condense and extend std.Treap's traversal functionalities. #20002

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jeru
Copy link

@jeru jeru commented May 19, 2024

The core functionalities are now in two general functions extremeInSubtreeOnDirection() and nextOnDirection() so all the other traversing functions (getMin(), getMax(), and InorderIterator) are all just trivial calls to these core functions.

The added two functions Node.next() and Node.prev() are also just trivial calls to these.

@jeru
Copy link
Author

jeru commented May 19, 2024

I think the error come from me forgetting to zig fmt one file...

The core functionalities are now in two general functions
`extremeInSubtreeOnDirection()` and `nextOnDirection()` so all the other
traversing functions (`getMin()`, `getMax()`, and `InorderIterator`) are
all just trivial calls to these core functions.

The added two functions `Node.next()` and `Node.prev()` are also just
trivial calls to these.
lib/std/treap.zig Outdated Show resolved Hide resolved
Copy link
Collaborator

@squeek502 squeek502 left a comment

Choose a reason for hiding this comment

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

Great work!

@jeru jeru requested a review from nektro May 20, 2024 06:31
@ehaas
Copy link
Sponsor Contributor

ehaas commented May 20, 2024

Can you add a test for getMin / getMax? This PR contains a compile error when using those functions (due to calling extremeInSubtreeOnDirection on self.root which is a ?*Node)

@jeru
Copy link
Author

jeru commented May 20, 2024

Can you add a test for getMin / getMax? This PR contains a compile error when using those functions (due to calling extremeInSubtreeOnDirection on self.root which is a ?*Node)

Done.

@jeru jeru requested a review from squeek502 May 21, 2024 10:51
@jeru
Copy link
Author

jeru commented May 21, 2024

@squeek502 Quite a lot of code is not covered by your previous approval. Mind another look? Thanks.

lib/std/treap.zig Outdated Show resolved Hide resolved
lib/std/treap.zig Outdated Show resolved Hide resolved
@jeru jeru force-pushed the master branch 3 times, most recently from 3207bf3 to 54c0fb8 Compare May 23, 2024 18:43
@jeru
Copy link
Author

jeru commented May 24, 2024

@andrewrk This PR has no more action item for me.

Just to clarify that I added @nektro as reviewer to see whether she has more feedback after her initial comment. Given how many days passed, I'd count that as "no further comments".

Let me know if you have more comments, and if not, merge this PR. Thanks.

@mlugg
Copy link
Member

mlugg commented May 24, 2024

Pinging Andrew doesn't automatically prioritize your PR. There is a large PR backlog which ought to be dealt with first - himself or another Zig core team member will get to this PR in time.

@jeru
Copy link
Author

jeru commented May 24, 2024

@mlugg Sorry for the noise. Didn't know the status.

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.

None yet

5 participants