An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Sorted Arrays in Go

[![CircleCI](https://img.shields.io/circleci/build/github/jfsmig/go-bags/main)](https://app.circleci.com/pipelines/github/jfsmig/go-bags)
[![Codacy](https://app.codacy.com/project/badge/Grade/aa58726a923b40e6a92fdacd77a344ae)](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)
[![CodeCov](https://img.shields.io/codecov/c/github/jfsmig/go-bags)](https://app.codecov.io/gh/jfsmig/go-bags)
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL_2.0-brightgreen.svg)](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)