Skip to content

jfsmig/go-bags

Repository files navigation

Sorted Arrays in Go

CircleCI Codacy CodeCov License: 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