https://github.com/jfsmig/go-bags
Golang sorted set
https://github.com/jfsmig/go-bags
generics go go-library go-package golang golang-generics golang-library golang-package sorted-arrays sorted-sets
Last synced: 4 months ago
JSON representation
Golang sorted set
- Host: GitHub
- URL: https://github.com/jfsmig/go-bags
- Owner: jfsmig
- License: mpl-2.0
- Created: 2022-05-24T08:18:39.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-12-30T14:49:55.000Z (5 months ago)
- Last Synced: 2026-01-01T16:30:00.555Z (5 months ago)
- Topics: generics, go, go-library, go-package, golang, golang-generics, golang-library, golang-package, sorted-arrays, sorted-sets
- Language: Go
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sorted Arrays in Go
[](https://app.circleci.com/pipelines/github/jfsmig/go-bags)
[](https://www.codacy.com/gh/jfsmig/go-bags/dashboard?utm_source=github.com&utm_medium=referral&utm_content=jfsmig/go-bags&utm_campaign=Badge_Grade)
[](https://app.codecov.io/gh/jfsmig/go-bags)
[](https://opensource.org/licenses/MPL-2.0)
Sorted array provide a complexity profile which make it suitable for collection with significantly more lookups that modifying operations:
* a compact memory footprint
* an efficient lookup complexity in O(log N)
* an efficient scan complexity since it depends on the lookup followed by a sequential scan of the array
* an insertion in O(N * log N) which is rather inefficient but remains acceptable if the operation is rather rare
3 flavors of generic sorted arrays for efficient lookup and paginated scans.
The official documentation can be found at [github.com/jfsmig/go-bags](https://pkg.go.dev/github.com/jfsmig/go-bags)