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

feat(datastructure): add Set data type #40

Merged
merged 6 commits into from
Apr 24, 2024
Merged

Conversation

irdaislakhuafa
Copy link
Owner

  • feat: add set data structure
  • feat(set): support multiple values add/delete
  • test(datastructure): add unit tests for SetInterface
  • feat: clear method in Set data structure
  • test(set): add slice, delete and exists modes
  • feat(datastructure): add Set data type

This commit introduces a new data structure, Set, which provides the basic operations of a set data structure:
- Add an element to the set.
- Check if an element exists in the set.
- Delete an element from the set.
- Get a slice of all elements in the set.
Adds support for adding and deleting multiple values to and from a set.

This change allows for more efficient handling of multiple values, as it eliminates the need to perform individual operations for each value.
This commit adds unit tests for the SetInterface to ensure that it is working as expected.

The tests cover the following scenarios:

- Adding a single item to the set
- Adding multiple items to the set
- Checking if an item exists in the set
- Deleting an item from the set
- Getting a slice of the items in the set
Adds `Clear` method to `Set` data structure to remove all values from the set.
This commit introduces three new modes to the set data structure: slice, delete, and exists.

The slice mode allows the user to pass a slice of values to the set, and the set will slice the elements.
The delete mode allows the user to pass a slice of values to the set, and the set will delete the elements.
The exists mode allows the user to pass a single value to the set, and the set will return whether or not the value exists in the set.
This commit introduces a new data structure, Set, which is similar to `slice` or `array` but does not allow duplicate elements.

The Set data type can be created using the `NewSet` function and can be used to store any type of comparable element.
@irdaislakhuafa irdaislakhuafa added the enhancement New feature or request label Apr 24, 2024
@irdaislakhuafa irdaislakhuafa merged commit e361798 into master Apr 24, 2024
1 check passed
@irdaislakhuafa irdaislakhuafa deleted the datastructure/set branch April 24, 2024 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant