{"id":18625615,"url":"https://github.com/varugasu/go-heap","last_synced_at":"2025-11-03T20:30:27.786Z","repository":{"id":112596728,"uuid":"495132605","full_name":"varugasu/go-heap","owner":"varugasu","description":"Heap implementation based on container/heap using Generics","archived":false,"fork":false,"pushed_at":"2022-05-28T19:22:31.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-27T06:09:50.326Z","etag":null,"topics":["data-structures","generics","go","golang","heap"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/varugasu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-05-22T17:42:38.000Z","updated_at":"2022-05-23T09:34:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"fa2121cb-c135-4cff-a957-91082f948467","html_url":"https://github.com/varugasu/go-heap","commit_stats":null,"previous_names":["varugasu/go-heap","vargasmesh/go-heap"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varugasu%2Fgo-heap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varugasu%2Fgo-heap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varugasu%2Fgo-heap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varugasu%2Fgo-heap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/varugasu","download_url":"https://codeload.github.com/varugasu/go-heap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239418578,"owners_count":19635208,"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":["data-structures","generics","go","golang","heap"],"created_at":"2024-11-07T04:35:24.214Z","updated_at":"2025-11-03T20:30:27.740Z","avatar_url":"https://github.com/varugasu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Heap with Generics\n\nA library to work with **Heaps** using **Generics**\n\nThe current heap solution in `container/heap` relies on the following interfaces:\n\n```go\npackage sort\n\ntype Interface interface {\n\tLen() int\n\tLess(i, j int) bool\n\tSwap(i, j int)\n}\n```\n\n```go\npackage heap\n\ntype Interface interface {\n\tsort.Interface\n\tPush(x any)\n\tPop() any\n}\n```\n\nBut with generics with **do not need** to **implement Interfaces**. Any slice will work as long as we define a `Less` function.\n\n```go\ntype Less[T any] func(t1, t2 T) bool\n\nfunc Heapify[T any](t []T, less Less[T])\n```\n\nThis `Less` function allow us to create **any kind of Heap**, even with **custom algorithms** for complex data structures\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarugasu%2Fgo-heap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarugasu%2Fgo-heap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarugasu%2Fgo-heap/lists"}