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

[WIP] Mutable dynamic arrays, heaps, and simple union find data structures #585

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

marzipankaiser
Copy link
Contributor

For writing examples, I wanted to have some standard mutable data structures, currently:

  • dynamic/resizable arrays
  • min-heap (=> priority queue)
  • union-find on integers

They all still need more documentation, testing and maybe some additional functions (I only implemented what I needed).

Copy link
Contributor

@jiribenes jiribenes left a 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. :)

libraries/common/heap.effekt Outdated Show resolved Hide resolved
Comment on lines +9 to +16
// These numbers should be optimized based on benchmarking
// According to https://en.wikipedia.org/wiki/Dynamic_array most use 1.5 or 2
//
// Factor by which to grow the capacity when it becomes too small
val growFactor = 1.5
// shrink array when size / capacity falls below this threshold
// should be < 1/growFactor
val shrinkThreshold = 0.4
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that this requires #496 in order to work on LLVM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I know 😢

libraries/common/resizable_array.effekt Outdated Show resolved Hide resolved
libraries/common/resizable_array.effekt Outdated Show resolved Hide resolved
libraries/common/resizable_array.effekt Outdated Show resolved Hide resolved
libraries/common/union_find.effekt Outdated Show resolved Hide resolved
marzipankaiser and others added 4 commits September 10, 2024 17:05
Co-authored-by: Jiří Beneš <mail@jiribenes.com>
Co-authored-by: Jiří Beneš <mail@jiribenes.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants