{"id":37183832,"url":"https://github.com/pedro-git-projects/go-data-structures-and-algorithms","last_synced_at":"2026-01-14T21:14:02.247Z","repository":{"id":118996466,"uuid":"592389406","full_name":"pedro-git-projects/go-data-structures-and-algorithms","owner":"pedro-git-projects","description":"Implementation of most of the classical data structures and algorithms in Go","archived":false,"fork":false,"pushed_at":"2023-01-28T19:22:13.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-19T13:39:06.288Z","etag":null,"topics":["algorithms","data-structures","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pedro-git-projects.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-23T16:20:53.000Z","updated_at":"2023-02-08T22:03:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"7c19e16a-84d6-4cfb-b2fa-b4272d95fe29","html_url":"https://github.com/pedro-git-projects/go-data-structures-and-algorithms","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pedro-git-projects/go-data-structures-and-algorithms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedro-git-projects%2Fgo-data-structures-and-algorithms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedro-git-projects%2Fgo-data-structures-and-algorithms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedro-git-projects%2Fgo-data-structures-and-algorithms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedro-git-projects%2Fgo-data-structures-and-algorithms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pedro-git-projects","download_url":"https://codeload.github.com/pedro-git-projects/go-data-structures-and-algorithms/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedro-git-projects%2Fgo-data-structures-and-algorithms/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28434640,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","data-structures","go","golang"],"created_at":"2026-01-14T21:14:01.630Z","updated_at":"2026-01-14T21:14:02.233Z","avatar_url":"https://github.com/pedro-git-projects.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Data Structures and Algorithms in Go\n\n### Table of Contents  \n\n---\n\n#### Data Structures\n\n- [Linked List](#linked-list)\n- [Two Pointer Node](#two-pointer-node)\n- [Doubly Linked List](#doubly-linked-list)\n- [Item](#item)\n- [Stack](#stack)\n- [Queue](#queue)\n- [Binary Node](#binary-node)\n- [Binary Search Tree](#binary-search-tree)\n- [Hash Node](#hash-node)\n- [Hash Table](#hash-table)\n- [Set](#set)\n- [Graph](#graph)\n\n#### Algorithms\n\n- [Bubble Sort](#bubble-sort)\n- [Selection Sort](#selection-sort)\n- [Insertion Sort](#insertion-sort)\n- [Merge Sort](#merge-sort)\n- [Quick Sort](#quick-sort)\n\n\t---\n\n### Node\n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/tree/master/structures/node)\n\n```go\npackage node\n\ntype Node[T any] struct {\n\tvalue T\n\tnext  *Node[T]\n}\n```\n\n\n\n### Linked List\n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/tree/master/structures/linkedlist)\n\n```go\ntype LinkedList[T any] struct {\n\thead   *node.Node[T]\n\ttail   *node.Node[T]\n\tlength int\n}\n```\n\n### Two Pointer Node\n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/tree/master/structures/dnode)\n\n```go\ntype DNode[T any] struct {\n\tvalue T\n\tnext  *DNode[T]\n\tprev  *DNode[T]\n}\n```\n\n### Doubly Linked List\n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/tree/master/structures/dlinkedlist)\n\n```go\ntype DLinkedList[T any] struct {\n\thead   *dnode.DNode[T]\n\ttail   *dnode.DNode[T]\n\tlength int\n}\n```\n\n### Item\n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/tree/master/structures/item)\n\n```go\ntype Item[T any] struct {\n\tvalue T\n\tnext  *Item[T]\n}\n```\n\n### Stack\n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/tree/master/structures/stack)\n\n```go\ntype Stack[T any] struct {\n\ttop    *item.Item[T]\n\theight int\n}\n```\n\n### Queue \n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/tree/master/structures/queue)\n\n```go\ntype Queue[T any] struct {\n\tfirst  *item.Item[T]\n\tlast   *item.Item[T]\n\tlenght int\n}\n```\n\n### Binary Node \n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/tree/master/structures/bnode)\n\n```go\ntype BNode[T constraints.Ordered] struct {\n\tvalue T\n\tleft  *BNode[T]\n\tright *BNode[T]\n}\n```\n### Binary Search Tree \n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/tree/master/structures/binsrchtree)\n\n```go\ntype BST[T constraints.Ordered] struct {\n\troot *bnode.BNode[T]\n}\n```\n\n### Hash Node \n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/tree/master/structures/hnode)\n\n```go\ntype HNode[T any] struct {\n\tkey   any\n\tvalue T\n\tnext  *HNode[T]\n}\n```\n### Hash Table \n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/tree/master/structures/hashtable)\n\n```go\nconst defaultCapacity uint64 = 1 \u003c\u003c 10\n\ntype HashTable[T any] struct {\n\tcapacity uint64\n\ttable    [defaultCapacity]*hnode.HNode[T]\n}\n```\n### Set \n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/tree/master/structures/set)\n\n```go\ntype Set[T comparable] interface {\n\tInsert(el T) bool\n\tErase(el T)\n\tCardinality() int\n\tClear()\n\tContains(el ...T) bool\n\tDifference(Set[T]) Set[T]\n\tEquals(Set[T]) bool\n\tIntersection(Set[T]) Set[T]\n\tIsSubset(Set[T]) bool\n\tIsProperSubset(Set[T]) bool\n\tIsSuperset(Set[T]) bool\n\tIsProperSuperset(Set[T]) bool\n\tUnion(Set[T]) Set[T]\n\tString() string\n\tToSlice() []T\n}\n```\n\n### Graph \n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/tree/master/structures/graph)\n\n```go\ntype Graph[T comparable] struct {\n\tadjacencyList map[T]set.Set[T]\n}\n```\n\n### Bubble Sort \n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/blob/master/sort/bubble.go)\n\n```go\nfunc Bubble[T constraints.Ordered](s []T) {\n\tfor i := len(s) - 1; i \u003e 0; i-- {\n\t\tfor j := 0; j \u003c i; j++ {\n\t\t\tif s[j] \u003e s[j+1] {\n\t\t\t\ttmp := s[j]\n\t\t\t\ts[j] = s[j+1]\n\t\t\t\ts[j+1] = tmp\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\n### Selection Sort \n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/blob/master/sort/selection.go)\n\n```go\nfunc Selection[T constraints.Ordered](s []T) {\n\tfor i := range s {\n\t\tmin := i\n\t\tfor j := i + 1; j \u003c len(s); j++ {\n\t\t\tif s[j] \u003c s[min] {\n\t\t\t\tmin = j\n\t\t\t}\n\t\t}\n\t\tif i != min {\n\t\t\ttmp := s[i]\n\t\t\ts[i] = s[min]\n\t\t\ts[min] = tmp\n\t\t}\n\t}\n}\n```\n\n### Insertion Sort \n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/blob/master/sort/insertion.go)\n\n```go\nfunc Insertion[T constraints.Ordered](s []T) {\n\tfor i := range s {\n\t\ttmp := s[i]\n\t\tj := i - 1\n\n\t\tfor j \u003e= 0 \u0026\u0026 tmp \u003c s[j] {\n\t\t\ts[j+1] = s[j]\n\t\t\ts[j] = tmp\n\t\t\tj--\n\t\t}\n\t}\n}\n```\n\n### Merge Sort \n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/blob/master/sort/merge.go)\n\n```go\nfunc MergeSort[T constraints.Ordered](s *[]T) {\n\tls := len(*s)\n\tmid := ls / 2\n\n\tif ls \u003c= 1 {\n\t\treturn\n\t}\n\n\ts1 := (*s)[mid:]\n\ts2 := (*s)[:mid]\n\n\tMergeSort(\u0026s1)\n\tMergeSort(\u0026s2)\n\tmerge(s, \u0026s1, \u0026s2)\n}\n```\n\n### Quick Sort \n\n[Code](https://github.com/pedro-git-projects/go-data-structures-and-algorithms/blob/master/sort/quick.go)\n\n```go\nfunc Quick[T constraints.Ordered](s []T) {\n\tif len(s) \u003c= 1 {\n\t\treturn\n\t}\n\tquickStep(s, 0, len(s)-1)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedro-git-projects%2Fgo-data-structures-and-algorithms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpedro-git-projects%2Fgo-data-structures-and-algorithms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedro-git-projects%2Fgo-data-structures-and-algorithms/lists"}