Skip to content

Add disjoint-set data structure#136

Open
Ayilay wants to merge 2 commits into
tezc:masterfrom
Ayilay:disjoint_set
Open

Add disjoint-set data structure#136
Ayilay wants to merge 2 commits into
tezc:masterfrom
Ayilay:disjoint_set

Conversation

@Ayilay
Copy link
Copy Markdown

@Ayilay Ayilay commented Dec 12, 2025

Contains README, and Unit Tests using standard asserts.

Contains additional unit tests using Unity (not included). The file unity_test_disjoint.c is ignored by the build system, but serves as reference for additional valid use cases.

Code style is mimicked to the best of my ability to match the other data structures in this collection.

I needed to use a disjoint set for day8 of Advent of Code, which I prefer to do in C. Hope it makes a welcome addition to your collection.

Contains README, and Unit Tests using standard asserts.

Contains additional unit tests using Unity (not included).
The file unity_test_disjoint.c is ignored by the build system,
but serves as reference for additional valid use cases.

Code style is mimiced to the best of my ability to match the
other data structures in this collection.
@Ayilay
Copy link
Copy Markdown
Author

Ayilay commented May 16, 2026

Kindly checking in a few months later to see if this feature is still interesting. I'd be happy to make the necessary adjustments to help this get merged. Kind regards.

@tezc
Copy link
Copy Markdown
Owner

tezc commented May 16, 2026

Hi @Ayilay sorry, I was swamped with other things. I'll review this shortly. Thank you for your patience.

@tezc tezc closed this May 16, 2026
@tezc tezc reopened this May 16, 2026
@tezc
Copy link
Copy Markdown
Owner

tezc commented May 16, 2026

@Ayilay Please see the CI failure above. Could you copy a CMakeLists.txt from another directory to disjoint dir?
For example, you can copy this one and rename uri to disjoint in a few lines.: https://github.com/tezc/sc/blob/master/uri/CMakeLists.txt

@@ -0,0 +1,84 @@
#include "sc_disjoint.h"
#include "unity.h"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I try to avoid adding dependency to this project to keep it simple. Please try to write tests without this. As far as I understand, there is nothing complex about the tests and perhaps all we need is assert()?

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.

2 participants