gitmyhub

gods

Go ★ 17k updated 1y ago

GoDS (Go Data Structures) - Sets, Lists, Stacks, Maps, Trees, Queues, and much more

GoDS is a Go library of ready-made data structures (trees, sets, queues, maps, linked lists) you can drop into any Go project without implementing them from scratch, with no external dependencies.

Gosetup: easycomplexity 2/5

GoDS, short for Go Data Structures, is a Go library that implements a wide set of classic data structures and the algorithms that go with them. Data structures are the standard ways programmers organise values in memory so they can be added, looked up, ordered, or iterated over efficiently. Go's built-in language only ships slices and maps, so projects that need things like trees, sets, queues, or linked lists usually pull in a library like this one.

The README groups what is provided into containers and helper functions. The containers include lists (ArrayList, SinglyLinkedList, DoublyLinkedList), sets (HashSet, TreeSet, LinkedHashSet), stacks, maps (HashMap, TreeMap, LinkedHashMap, plus bidirectional maps that let you look up by value too), trees (RedBlackTree, AVLTree, BTree, BinaryHeap), and queues (including a CircularBuffer and a PriorityQueue). Every container implements a shared Container interface with Empty, Size, Clear, Values, and String methods. Ordered containers also expose iterators (some reversible), and many support enumerable operations and JSON serialization through provided JSONSerializer and JSONDeserializer helpers.

Someone would use this when they are writing Go code and need a data structure that is more specialised than slice or map without rolling it themselves, for example an AVL tree for sorted lookups, a circular buffer for a bounded queue, or a bidirectional map. The README includes code examples for each structure showing exactly which methods are available. The tech stack is Go, with no dependencies beyond the standard library, and the project is BSD 2-Clause licensed. The full README is longer than what was provided.

Where it fits