Skip to content

Conversation

kamikkels
Copy link
Contributor

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

  • I have performed a self-review of my code
  • My code follows the style guidelines of this project
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Comments in areas I changed are up to date
  • I have added comments to hard-to-understand areas of my code
  • I have made corresponding changes to the README.md

@kamikkels kamikkels requested a review from siriak as a code owner October 1, 2025 12:18
@Copilot Copilot AI review requested due to automatic review settings October 1, 2025 12:18
Copy link

@Copilot Copilot AI left a 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.

@siriak
Copy link
Member

siriak commented Oct 1, 2025

Please act on comments and resolve Codacy issue

Adjust null handling for previous in Bag.Add function
Copy link

codecov bot commented Oct 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.18%. Comparing base (178d7f9) to head (bb1abc5).
⚠️ Report is 1 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@siriak siriak 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, thanks!

@siriak siriak enabled auto-merge (squash) October 2, 2025 11:57
@siriak siriak disabled auto-merge October 2, 2025 14:23
@siriak siriak enabled auto-merge (squash) October 2, 2025 14:23
@siriak siriak disabled auto-merge October 2, 2025 14:23
@siriak siriak merged commit 6c220ce into TheAlgorithms:master Oct 2, 2025
3 of 4 checks passed
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