-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add bag datastructure #531
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
Add bag datastructure #531
Conversation
Updated bag documentation Add tests for bag
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.
Pull Request Overview
Adds a new Bag (multiset) data structure implementation that allows multiple instances of the same element with multiplicity tracking.
- Implements a generic Bag class with linked list-based storage
- Adds comprehensive test coverage for all bag operations
- Updates README documentation to include the new data structure
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
README.md | Adds Bag to the data structures section |
DataStructures/Bag/BagNode.cs | Defines node structure with item, multiplicity, and next pointer |
DataStructures/Bag/Bag.cs | Implements the main Bag class with Add, Clear, Count, and enumeration methods |
DataStructures.Tests/BagTests.cs | Provides comprehensive unit tests for all bag functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Please act on comments and resolve Codacy issue |
Adjust null handling for previous in Bag.Add function
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #531 +/- ##
==========================================
- Coverage 95.20% 95.18% -0.02%
==========================================
Files 272 274 +2
Lines 10862 10910 +48
Branches 1530 1535 +5
==========================================
+ Hits 10341 10385 +44
- Misses 397 400 +3
- Partials 124 125 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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, thanks!
Adding a bag (or multiset/mset) datastructure
See https://en.wikipedia.org/wiki/Multiset for details, or https://algs4.cs.princeton.edu/13stacks/ for the inspiration