{"id":20315232,"url":"https://github.com/sysread/skewheap","last_synced_at":"2026-04-17T15:02:23.385Z","repository":{"id":56839843,"uuid":"126073592","full_name":"sysread/SkewHeap","owner":"sysread","description":"A fast, efficient, self-adjusting heap for Perl, implemented in C","archived":false,"fork":false,"pushed_at":"2018-08-26T17:27:12.000Z","size":74,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-07T01:08:01.950Z","etag":null,"topics":["c","data-structures","heap","perl","skew-heap","xs"],"latest_commit_sha":null,"homepage":null,"language":"XS","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/sysread.png","metadata":{"files":{"readme":"README.pod","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-20T19:46:06.000Z","updated_at":"2022-08-26T06:12:54.000Z","dependencies_parsed_at":"2022-08-28T23:31:04.698Z","dependency_job_id":null,"html_url":"https://github.com/sysread/SkewHeap","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/sysread/SkewHeap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysread%2FSkewHeap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysread%2FSkewHeap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysread%2FSkewHeap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysread%2FSkewHeap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sysread","download_url":"https://codeload.github.com/sysread/SkewHeap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysread%2FSkewHeap/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264502990,"owners_count":23618672,"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":["c","data-structures","heap","perl","skew-heap","xs"],"created_at":"2024-11-14T18:18:23.565Z","updated_at":"2026-04-17T15:02:18.346Z","avatar_url":"https://github.com/sysread.png","language":"XS","funding_links":[],"categories":[],"sub_categories":[],"readme":"=head1 NAME\n\nSkewHeap - A fast and flexible heap structure\n\n=head1 SYNOPSIS\n\n  use SkewHeap;\n\n  my $heap = skewheap{ $a \u003c=\u003e $b };\n  $heap-\u003eput(42);\n  $heap-\u003eput(35);\n  $heap-\u003eput(200, 62);\n\n  $heap-\u003etop;  # 35\n  $heap-\u003esize; # 4\n\n  $heap-\u003etake; # 35\n  $heap-\u003etake; # 42\n  $heap-\u003etake; # 62\n  $heap-\u003etake; # 200\n\n  my $merged_heap = $heap-\u003emerge($other_skewheap);\n\n=head1 DESCRIPTION\n\nA skew heap is a memory efficient, self-adjusting heap (or priority queue) with\nan amortized performance of O(log n) (or better). C\u003cSkewHeap\u003e is implemented in\nC\u003cC\u003e/C\u003cXS\u003e.\n\nThe key feature of a skew heap is the ability to quickly and efficiently merge\ntwo heaps together.\n\n=head1 METHODS\n\n=head2 skewheap\n\nCreates a new C\u003cSkewHeap\u003e which will be sorted in ascending order using the\ncomparison subroutine passed in. This sub has the same semantics as Perl's\nC\u003csort\u003e, returning -1 if C\u003c$a E\u003clt\u003e $b\u003e, 1 if C\u003c$a E\u003cgt\u003e $b\u003e, or 0 if\nC\u003c$a == $b\u003e.\n\n=head2 size\n\nReturns the number of elements in the heap.\n\n=head2 top\n\nReturns the next element which would be returned by L\u003c/take\u003e without removing\nit from the heap.\n\n=head2 put\n\nInserts one or more new elements into the heap.\n\n=head2 take\n\nRemoves and returns the next element from the heap.\n\n=head2 merge\n\nNon-destructively merges two heaps into a new heap. Returns the new heap.\n\n=head1 AUTHOR\n\nJeff Ober \u003csysread@fastmail.fm\u003e\n\n=head1 COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2018 by Jeff Ober. This is free software; you\ncan redistribute it and/or modify it under the same terms as the Perl 5\nprogramming language system itself.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysread%2Fskewheap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsysread%2Fskewheap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysread%2Fskewheap/lists"}