https://github.com/simonwhitaker/swift-bag
An implementation of the bag (multiset) data structure in Swift
https://github.com/simonwhitaker/swift-bag
Last synced: 3 months ago
JSON representation
An implementation of the bag (multiset) data structure in Swift
- Host: GitHub
- URL: https://github.com/simonwhitaker/swift-bag
- Owner: simonwhitaker
- Created: 2017-08-28T07:35:15.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-04-15T18:42:41.000Z (about 4 years ago)
- Last Synced: 2025-01-01T02:29:05.803Z (over 1 year ago)
- Language: Swift
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# An implementation of the bag data stucture in Swift
## Usage
``` swift
var b = Bag();
for c in "hello".characters {
b.add(c)
}
let count = b.count // count is 5
let lcount = b.count(for: "l") // lcount is 2
```