-
Notifications
You must be signed in to change notification settings - Fork 31
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
Mutable dynamic arrays, heaps, and simple union find data structures #585
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far!
I had some time during the meeting, so I quickly wrote some observations. :)
ee9d209
to
58c8510
Compare
What happened to this PR, it looks really cool! :) |
@b-studios Mostly I didn't get around to doing much here since. The code is tested as far as the tests here go (so not much), but should mostly work (TM). |
dc62953
to
597bded
Compare
Rebased, cleaned up a bit. Should be fine, except not tested well and not documented in too much detail, either. |
Co-authored-by: Jiří Beneš <[email protected]>
Co-authored-by: Jiří Beneš <[email protected]>
45b9185
to
88c4f5e
Compare
Rebased to check if the Valgrind-issues happen to be fixed by now. |
/// find and remove the minimal element in this heap | ||
/// | ||
/// O(log n) | ||
def deleteMin[T](heap: Heap[T]): T / Exception[OutOfBounds] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bike shed, in the comment you write "remove" but the function is called deleteMin
. Some languages also call this operation pop
(and insert
then push
):
https://doc.rust-lang.org/std/collections/struct.BinaryHeap.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose the names based on what https://en.wikipedia.org/wiki/Binary_heap calls the operations, but we can rename them - I don't have a strong opinion here.
🪤 It could be fun to take the unification benchmark from |
For writing examples, I wanted to have some standard mutable data structures, currently:
They all still need more documentation, testing and maybe some additional functions (I only implemented what I needed).