{"id":22235022,"url":"https://github.com/pzaino/gods","last_synced_at":"2025-07-27T21:32:34.911Z","repository":{"id":248936333,"uuid":"830221938","full_name":"pzaino/gods","owner":"pzaino","description":"GoDS is just a Go Lang library of Datastructures I created for my own projects and to practice some generic programming in go","archived":false,"fork":false,"pushed_at":"2024-11-30T23:45:57.000Z","size":701,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-01T00:27:22.146Z","etag":null,"topics":["algorithms","buffer","circular-buffer","data-structures","doubly-linked-list","go","golang","linked-list","priority-queue","queues","stack"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pzaino.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-17T21:00:41.000Z","updated_at":"2024-11-30T23:45:54.000Z","dependencies_parsed_at":"2024-10-25T04:07:42.346Z","dependency_job_id":"a6138e25-6365-477f-88f9-55c01c8e154d","html_url":"https://github.com/pzaino/gods","commit_stats":null,"previous_names":["pzaino/gods"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzaino%2Fgods","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzaino%2Fgods/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzaino%2Fgods/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzaino%2Fgods/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pzaino","download_url":"https://codeload.github.com/pzaino/gods/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227837018,"owners_count":17827066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","buffer","circular-buffer","data-structures","doubly-linked-list","go","golang","linked-list","priority-queue","queues","stack"],"created_at":"2024-12-03T02:11:19.641Z","updated_at":"2024-12-03T02:11:20.112Z","avatar_url":"https://github.com/pzaino.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoDS (Go Data Structures)\n\n\u003cimg align=\"right\" width=\"320\" height=\"280\"\n src=\"https://raw.githubusercontent.com/pzaino/gods/main/images/logo.png\" alt=\"GoDS Logo\"\u003e\n\n![Go build: ](https://github.com/pzaino/gods/actions/workflows/go.yml/badge.svg)\n[![Go Report Card](https://goreportcard.com/badge/github.com/pzaino/gods)](https://goreportcard.com/report/github.com/pzaino/gods)\n[![Go-VulnCheck](https://github.com/pzaino/gods/actions/workflows/go-vulncheck.yml/badge.svg)](https://github.com/pzaino/gods/actions/workflows/go-vulncheck.yml)\n![Scorecard supply-chain security](https://github.com/pzaino/gods/actions/workflows/scorecard.yml/badge.svg)\n![CodeQL](https://github.com/pzaino/gods/actions/workflows/codeql.yml/badge.svg)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/59dfeec6d51942a188e474b9bfc22249)](https://app.codacy.com/gh/pzaino/gods/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n[![FOSSA license](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fpzaino%2Fgods.svg?type=shield\u0026issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2Fpzaino%2Fgods?ref=badge_shield\u0026issueType=license)\n[![FOSSA Security](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fpzaino%2Fgods.svg?type=shield\u0026issueType=security)](https://app.fossa.com/projects/git%2Bgithub.com%2Fpzaino%2Fgods?ref=badge_shield\u0026issueType=security)\n[![OSV Security](https://github.com/pzaino/gods/actions/workflows/osv-scanner.yml/badge.svg)](https://github.com/pzaino/gods/actions/workflows/osv-scanner.yml/badge.svg)\n\n**WIP**: This project is still a work in progress. I will be adding more data\n structures as I implement them. Please do not use it yet, as it is not ready\n  for production.\n\nThis repository contains my implementations of various data structures in Go.\n The data structures are implemented in two ways:\n\n- Lockless: You can find these in the `pkg` directory with their \"standard\"\n names, e.g., stack, linkedList.\n- Concurrency-safe wrapper: You can find these in the `pkg` directory with the\n prefix \"cs\", e.g., csstack, cslinkedList.\n\nUse the non-concurrent-safe data structures if you need the best performance\n in a non-concurrent application or if you want to handle concurrency yourself.\n  Use the concurrent-safe data structures for the best approach in concurrent\n   applications or if you prefer not to handle concurrency yourself.\n\nBoth implementations generally come with three special methods:\n\n- `ConfinedForEach`: This method iterates over the data structure and executes\n a function for each element. The function is executed in a separate goroutine\n  for each element.\n- `ConfinedForFrom`: This method iterates over the data structure and executes\n a function for each element starting from a given element. The function is\n  executed in a separate goroutine for each element.\n- `ConfinedForRange`: This method iterates over the data structure and\n executes a function for each element within a given range. The function is\n executed in a separate goroutine for each element.\n\nThese three methods offer better performance when there are multiple CPU cores\n available. They are also useful when you want to execute a function for each\n  element in parallel. The number of goroutines created will be equal to the\n   number of CPU cores available.\n\nEvery other method is not parallel. The Buffer has a special set of methods\n called:\n\n- `Blit`: This method combines/overwrites the elements of the buffer with the\n elements of another buffer using a custom function. If the two buffers have\n  different lengths, the function will use the size of the smaller buffer.\n- `BlitFrom`: This method combines/overwrites the elements of the buffer with\n the elements of another buffer starting from a given index using a custom\n  function. If the two buffers have different lengths, the function will use\n   the size of the smaller buffer.\n- `BlitRange`: This method combines/overwrites the elements of the buffer\n with the elements of another buffer within a given range using a custom\n  function.\n\nThese functions are special because, for large amounts of data, they use\n parallelism to speed up the process. The number of goroutines created will\n  be equal to the number of CPU cores available.\n\n## Packaging and General Design\n\nAll data structures come with a set of tests to ensure that they work as\n expected.\n\nEach data structure is implemented as a separate package in the `pkg`\n directory. The `cmd` directory contains a set of example programs that\n  demonstrate how to use the data structures.\n\nThis design should make it easy to use the data structures in your own\n projects without significantly increasing your code size. You can simply\n  import the package you need and start using it.\n\nAll data structures are designed to use generics, so some method calls may\n require you to provide a comparison function, hash function, etc.\n\n## Installation / Usage\n\nTo use a library, you need to import it into your code. For example, to use\n the stack data structure, you would do:\n\n```go\nimport \"github.com/pzaino/gods/pkg/stack\"\n```\n\nThen you can start using the stack data structure in your code.\n\nYou can use more than one data structure in your code. Just import the ones\n you need.\n\nYou may need to \"install\" the library first. To do that, use the following\n command:\n\n```bash\ngo get github.com/pzaino/gods\n```\n\nThis will download the library and install it in your `$GOPATH`.\n\n## Data Structures\n\n- [x] [Stack](./pkg/stack)\n- [x] [Concurrent Stack](./pkg/csstack)\n- [x] [Buffer](./pkg/buffer)\n- [x] [Concurrent Buffer](./pkg/csbuffer)\n- [ ] [Ring Buffer](./pkg/ringBuffer)\n- [ ] [Concurrent Ring Buffer](./pkg/csringBuffer)\n- [ ] [A/B Buffer](./pkg/abBuffer)\n- [ ] [Concurrent A/B Buffer](./pkg/csabBuffer)\n- [x] [Queue](./pkg/queue)\n- [ ] [Concurrent Queue](./pkg/csqueue)\n- [x] [Priority Queue](./pkg/pqueue)\n- [ ] [Concurrent Priority Queue](./pkg/cspqueue)\n- [x] [Linked List](./pkg/linkList)\n- [x] [Concurrent Linked List](./pkg/cslinkList)\n- [x] [Doubly Linked List](./pkg/dlinkList)\n- [x] [Concurrent Doubly Linked List](./pkg/csdlinkList)\n- [x] [Circular Linked List](./pkg/circularLinkList)\n- [ ] [Concurrent Circular Linked List](./pkg/cscircularLinkList)\n- [ ] [Binary Search Tree](./pkg/binarySearchTree)\n- [ ] [AVL Tree](./pkg/avlTree)\n- [ ] [Trie](./pkg/trie)\n- [ ] [Graph](./pkg/graph)\n- [ ] [Disjoint Set](./pkg/disjointSet)\n- [ ] [Segment Tree](./pkg/segmentTree)\n- [ ] [Fenwick Tree](./pkg/fenwickTree)\n\nLegend:\n\n- [x] Implemented\n- [ ] Not implemented yet (WIP)\n\nGiven that this project is still a WIP, I may change the APIs as I move forward\n with the work. I will try to keep the changes to a minimum and make them as\n  easy to adapt to as possible. However, I also want to achieve a good design.\n\n## License\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fpzaino%2Fgods.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fpzaino%2Fgods?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpzaino%2Fgods","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpzaino%2Fgods","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpzaino%2Fgods/lists"}