{"id":18952477,"url":"https://github.com/simonwhitaker/swift-heap","last_synced_at":"2025-06-18T20:33:39.533Z","repository":{"id":137108096,"uuid":"98793996","full_name":"simonwhitaker/Swift-Heap","owner":"simonwhitaker","description":"An implementation of the heap data structure in Swift","archived":false,"fork":false,"pushed_at":"2023-02-14T16:58:02.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-02T01:17:05.726Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","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/simonwhitaker.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":"2017-07-30T11:48:08.000Z","updated_at":"2023-02-14T16:57:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"56e863ec-69ab-4513-85f2-4844587940e1","html_url":"https://github.com/simonwhitaker/Swift-Heap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/simonwhitaker/Swift-Heap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonwhitaker%2FSwift-Heap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonwhitaker%2FSwift-Heap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonwhitaker%2FSwift-Heap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonwhitaker%2FSwift-Heap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonwhitaker","download_url":"https://codeload.github.com/simonwhitaker/Swift-Heap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonwhitaker%2FSwift-Heap/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260629449,"owners_count":23038925,"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":[],"created_at":"2024-11-08T13:33:37.218Z","updated_at":"2025-06-18T20:33:34.518Z","avatar_url":"https://github.com/simonwhitaker.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# An implementation of the heap data stucture in Swift\n\n## Usage\n\nA heap over a type that conforms to Comparable is a min-heap by default.\n\n``` swift\nvar h = Heap\u003cInt\u003e();\nh.add(4);\nh.add(9);\nh.add(2);\nlet i = h.top! // i is 2\n```\n\nPass a `comparator` argument to the constructor for custom behaviour. For example, to use a max heap:\n\n``` swift\nvar h = Heap\u003cInt\u003e(comparator: \u003e);\nh.add(4);\nh.add(9);\nh.add(2);\nlet i = h.top! // i is 9\n```\n\nOr to order strings by length:\n\n``` swift\nvar h = Heap\u003cString\u003e { $0.length \u003c $1.length };\nh.add(\"foo\");\nh.add(\"bar\");\nh.add(\"bo\");\nlet s = h.top! // s is \"bo\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonwhitaker%2Fswift-heap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonwhitaker%2Fswift-heap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonwhitaker%2Fswift-heap/lists"}