# zyedidia/generic

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/zyedidia-generic).**

1,347 stars · 81 forks · Go · MIT

## Links

- GitHub: https://github.com/zyedidia/generic
- awesome-repositories: https://awesome-repositories.com/repository/zyedidia-generic.md

## Topics

`data-structures` `generics` `go`

## Description

This project is a comprehensive library of type-safe, high-performance data structures for Go. By leveraging language-level generics, it provides reusable containers and algorithms that eliminate the need for runtime type assertions or interface casting, ensuring efficient and type-safe data management.

The library distinguishes itself through its support for persistent data structures and specialized indexing. It utilizes copy-on-write semantics and memory sharing to maintain multiple versions of a collection, allowing for efficient modifications without duplicating entire datasets. Additionally, it includes advanced structures such as interval trees for range-based queries and trie implementations for rapid prefix searching and hierarchical data retrieval.

The collection covers a broad range of foundational storage mechanisms, including associative mappings, heaps, queues, stacks, and cache-friendly unrolled lists. It also provides utilities for memory-constrained storage, featuring automatic eviction policies and custom callbacks to manage capacity effectively. These components are designed to support complex state management and high-performance data processing tasks.

## Tags

### Data & Databases

- [Go Generic Collections](https://awesome-repositories.com/f/data-databases/go-generic-collections.md) — Provides a comprehensive suite of optimized data structures including trees, heaps, and hash maps for Go.
- [Persistent Collections](https://awesome-repositories.com/f/data-databases/data-collections-datasets/persistent-collections.md) — Maintains historical states of collections by sharing memory between versions to allow efficient modifications.
- [Caching Structures](https://awesome-repositories.com/f/data-databases/high-performance-collection-processing/high-performance-containers/caching-structures.md) — Managing memory-constrained data stores with automatic eviction policies to maintain optimal performance for frequently accessed items.
- [Tree-Based Storage](https://awesome-repositories.com/f/data-databases/append-only-storage-engines/tree-based-storage.md) — The library organizes data in tree structures to facilitate fast searching, range queries, and interval management. ([source](https://github.com/zyedidia/generic/blob/master/README.md))
- [Bidirectional Mappings](https://awesome-repositories.com/f/data-databases/bidirectional-mappings.md) — Maintains dual-index structures to allow efficient lookups in both directions. ([source](https://github.com/zyedidia/generic/blob/master/bimap))
- [Self-Balancing Tree Implementations](https://awesome-repositories.com/f/data-databases/hierarchical-data-models/self-balancing-tree-implementations.md) — The library maintains data in self-balancing binary search trees to keep keys sorted and ensure logarithmic performance for operations. ([source](https://github.com/zyedidia/generic/blob/master/avl))
- [Trie-Based Inverted Indexes](https://awesome-repositories.com/f/data-databases/in-memory-indexes/trie-based-inverted-indexes.md) — Provides trie-based indexing for rapid prefix searching and hierarchical data retrieval.
- [Key-Value Pair Managers](https://awesome-repositories.com/f/data-databases/key-value-pair-managers.md) — Manages key-value pairs within hash-based structures that automatically resize for performance. ([source](https://github.com/zyedidia/generic/blob/master/hashmap))
- [Queue Implementations](https://awesome-repositories.com/f/data-databases/queue-implementations.md) — Maintains collections where the first element added is the first one removed using linked structures. ([source](https://github.com/zyedidia/generic/blob/master/queue))
- [Trie Implementations](https://awesome-repositories.com/f/data-databases/search-indexing-technologies/search-indexing/search-and-indexing/prefix-searches/trie-implementations.md) — The library organizes data in prefix-based structures to enable efficient retrieval, prefix searching, and management of associated values. ([source](https://github.com/zyedidia/generic/tree/master/trie))
- [Multi-Value Mappings](https://awesome-repositories.com/f/data-databases/sorted-key-value-maps/multi-value-mappings.md) — Organizes data into key-value pairs where each key maps to multiple values. ([source](https://github.com/zyedidia/generic/tree/master/multimap))
- [Unordered Unique Collection Management](https://awesome-repositories.com/f/data-databases/unordered-unique-collection-management.md) — The library stores collections of distinct elements using hash-based implementations to ensure membership uniqueness and efficient lookup. ([source](https://github.com/zyedidia/generic/blob/master/README.md))

### Programming Languages & Runtimes

- [Map Data Structures](https://awesome-repositories.com/f/programming-languages-runtimes/map-data-structures.md) — Provides associative mappings using hashing or tree strategies for fast data access. ([source](https://github.com/zyedidia/generic#readme))
- [Persistent Data Structures](https://awesome-repositories.com/f/programming-languages-runtimes/persistent-data-structures.md) — Provides persistent data structures using copy-on-write semantics to maintain multiple versions of collections efficiently.
- [Parameterized Type Definitions](https://awesome-repositories.com/f/programming-languages-runtimes/type-name-assignment/unique-type-identifiers/custom-data-type-declarations/parameterized-numeric-types/parameterized-types/parameterized-type-definitions.md) — Leverages language-level generics to provide type-safe data structures without runtime casting.
- [Grid Array Management](https://awesome-repositories.com/f/programming-languages-runtimes/array-data-structures/grid-array-management.md) — Stores and manipulates data in two-dimensional structures with coordinate-based access. ([source](https://github.com/zyedidia/generic/blob/master/array2d))
- [Linked Lists](https://awesome-repositories.com/f/programming-languages-runtimes/programming-utilities/data-structure-type-helpers/data-structures/linear-collections/linked-lists.md) — Stores elements in sequences where nodes point to neighbors for efficient modification. ([source](https://github.com/zyedidia/generic/blob/master/list))

### Software Engineering & Architecture

- [Generic Data Structures](https://awesome-repositories.com/f/software-engineering-architecture/abstract-data-types/generic-data-abstractions/generic-data-structures.md) — Leverages language generics to provide type-safe, reusable, and efficient data containers.
- [Copy-on-Write Data Structures](https://awesome-repositories.com/f/software-engineering-architecture/copy-on-write-data-structures.md) — Implements copy-on-write semantics to share memory between versions of data structures for efficient persistence.
- [Heap Management Operations](https://awesome-repositories.com/f/software-engineering-architecture/heaps/heap-insertion-algorithms/heap-management-operations.md) — Organizes elements in binary min-heap structures to ensure the smallest value is always accessible. ([source](https://github.com/zyedidia/generic/tree/master/heap))
- [Interval Tree Operations](https://awesome-repositories.com/f/software-engineering-architecture/interval-overlap-detection/interval-tree-operations.md) — Implements interval tree structures to provide efficient range-based queries and overlap detection with logarithmic performance.
- [Interval Indexing Utilities](https://awesome-repositories.com/f/software-engineering-architecture/interval-overlap-detection/interval-tree-operations/interval-indexing-utilities.md) — Identifies stored intervals that intersect with a range and returns associated values sorted by position. ([source](https://github.com/zyedidia/generic/blob/master/interval))
- [Linked Data Structures](https://awesome-repositories.com/f/software-engineering-architecture/linked-data-structures.md) — Uses pointer-based nodes to manage collections and enable efficient insertion and removal.
- [Memory-Limited Caches](https://awesome-repositories.com/f/software-engineering-architecture/memory-limited-caches.md) — Manages memory-constrained storage with automatic eviction policies to maintain fixed-capacity caches. ([source](https://github.com/zyedidia/generic#readme))
- [Specialized Data Structures](https://awesome-repositories.com/f/software-engineering-architecture/specialized-data-structures.md) — Provides a suite of optimized data structures including stacks, queues, and interval trees for specialized access patterns. ([source](https://github.com/zyedidia/generic#readme))
- [Comparison Logic Providers](https://awesome-repositories.com/f/software-engineering-architecture/structural-comparison-tools/comparison-logic-providers.md) — Decouples data structures from specific types by delegating comparison logic to user-defined functions.
- [Trie Data Structures](https://awesome-repositories.com/f/software-engineering-architecture/trie-data-structures.md) — Implements prefix-based trie structures for rapid string indexing and hierarchical data retrieval.
- [Prefix Trie Filters](https://awesome-repositories.com/f/software-engineering-architecture/trie-data-structures/prefix-trie-filters.md) — Organizes string-indexed data in trie structures to enable rapid prefix searching and routing.

### Part of an Awesome List

- [Unrolled List Implementations](https://awesome-repositories.com/f/awesome-lists/devtools/gpu-acceleration/deep-learning-acceleration/arm-cpu-tensor-operations/cache-friendly-tensor-operations/unrolled-list-implementations.md) — Implements cache-friendly unrolled lists to reduce pointer overhead and improve traversal performance.

### Development Tools & Productivity

- [Sequence Slicing](https://awesome-repositories.com/f/development-tools-productivity/data-sequence-manipulation/sequence-slicing.md) — The library provides methods to split, join, and extract segments of a sequence without copying underlying data to optimize memory usage. ([source](https://github.com/zyedidia/generic/blob/master/rope))

### Education & Learning Resources

- [Augmented Trees](https://awesome-repositories.com/f/education-learning-resources/educational-resources/algorithms-theory-academics/cs-theory-foundations/data-structure-implementations/data-structures/balanced-search-trees/red-black-trees/augmented-trees.md) — Provides augmented tree structures that maintain metadata for efficient range and intersection queries.
- [Implementations](https://awesome-repositories.com/f/education-learning-resources/stack-data-structures/implementations.md) — The library stores elements in a dynamic array that allows items to be added, removed, or inspected from the top. ([source](https://github.com/zyedidia/generic/blob/master/stack))

### Testing & Quality Assurance

- [Value Comparison Libraries](https://awesome-repositories.com/f/testing-quality-assurance/value-comparison-libraries.md) — Provides utilities to evaluate the relative order of items for sorting and comparison. ([source](https://github.com/zyedidia/generic/blob/master/DOC.md))
