{"id":20490752,"url":"https://github.com/demerphq/algorithm-heapify-xs","last_synced_at":"2025-09-09T11:23:25.014Z","repository":{"id":66926270,"uuid":"146190708","full_name":"demerphq/Algorithm-Heapify-XS","owner":"demerphq","description":"Perl module to provide basic heap/heapsort primitives, implemented in XS","archived":false,"fork":false,"pushed_at":"2018-08-27T06:46:33.000Z","size":72,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-31T08:21:13.083Z","etag":null,"topics":["heap","heapify","perl","xs"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/demerphq.png","metadata":{"files":{"readme":"README","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2018-08-26T15:04:59.000Z","updated_at":"2018-08-27T06:46:34.000Z","dependencies_parsed_at":"2023-02-23T04:30:23.795Z","dependency_job_id":null,"html_url":"https://github.com/demerphq/Algorithm-Heapify-XS","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/demerphq/Algorithm-Heapify-XS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demerphq%2FAlgorithm-Heapify-XS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demerphq%2FAlgorithm-Heapify-XS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demerphq%2FAlgorithm-Heapify-XS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demerphq%2FAlgorithm-Heapify-XS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/demerphq","download_url":"https://codeload.github.com/demerphq/Algorithm-Heapify-XS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demerphq%2FAlgorithm-Heapify-XS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274290583,"owners_count":25258152,"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","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["heap","heapify","perl","xs"],"created_at":"2024-11-15T17:18:24.251Z","updated_at":"2025-09-09T11:23:24.940Z","avatar_url":"https://github.com/demerphq.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"NAME\n    Algorithm::Heapify::XS - Perl extension for supplying simple heap\n    primitives for arrays.\n\nSYNOPSIS\n      use Algorithm::Heapify::XS qw(max_heapify max_heap_shift);\n      my @array= (1..10);\n      max_heapify(@array);\n      while (defined(my $top= max_heap_shift(@array))) {\n        print $top;\n      }\n\nDESCRIPTION\n    A heap is an array based data structure where the array is treated as a\n    balanced tree of items where each item obeys a given inequality\n    constraint with its parent and children, but not with its siblings. This\n    allows it to be put into \"nearly\" sorted order more efficiently than an\n    actual sort would.\n\n    This data structure has a number of nice properties:\n\n    a) the tree does not require \"child\" pointers, but instead infers\n    parent/child relationships from their position in the array. The parent\n    of a node i is defined to reside in position int((i-1)/2), and the left\n    and right children of a node i reside in position (i*2+1) and (i*2+2)\n    respectively.\n\n    b) \"heapifying\" an array is O(N) as compared to N * log2(N) for a\n    typical sort.\n\n    c) Accessing the top item is O(1), and removing it from the array is\n    O(log(N)).\n\n    d) Inserting a new item into the heap is O(log(N))\n\n    This means that for applications that need find only the top K of an\n    array can do it faster than sorting the array, and there is no need for\n    wrapper objects to represent the tree.\n\n  INTERFACE\n    All operations are in-place on the array passed as an argument, and all\n    require that the appropriate \"heapify\" (either max_heapify or\n    min_heapify) operation has been called on the array first. Typically\n    they return the \"top\" of the heap after the operation has been\n    performed, with the exception of the \"shift\" operation which returns the\n    \"top\" of the heap before removing it.\n\n    There are four variants of all subs provided. The \"max_\" and \"min_\"\n    variants, and the \"maxstr_\" and \"minstr_\" which provide descending and\n    ascending and numeric and string ordering respectively. If you wish more\n    precise control over the ordering of items in the heap, such as objects,\n    then \"use overload\" to provide the required semantics by overloading the\n    appropriate inequality operators, typically just one of \"\u003c=\u003e\" or \"cmp\"\n    operators need be overloaded.\n\n  EXPORT\n    None by default. All exports must be requested, or you can use \":all\" to\n    import then all, you can also import groups by prefix, eg \":max\",\n    \":min\", \":maxstr\", \":minstr\" and \":idx\" to export\n\n  SUBS\n    $max= max_heapify(@array)\n    $min= min_heapify(@array)\n    $maxstr= maxstr_heapify(@array)\n    $minstr= minstr_heapify(@array)\n        These subs \"heapify\" the array and return its \"top\" (min/max) value.\n        Prior use of the appropriate one of these subs is required to use\n        all the other subs offered by this package.\n\n    $max= max_heap_shift(@array)\n    $min= min_heap_shift(@array)\n    $maxstr= maxstr_heap_shift(@array)\n    $minstr= minstr_heap_shift(@array)\n        Return and remove the \"top\" (min/max) value from a heapified array\n        while maintain the arrays heap-order.\n\n    $max= max_heap_push(@array)\n    $min= min_heap_push(@array)\n    $maxstr= maxstr_heap_push(@array)\n    $minstr= minstr_heap_push(@array)\n        Insert an item into a heapified array while maintaining the arrays\n        heap-order, and return the resulting \"top\" (min/max) value.\n\n    $max= max_heap_adjust_top(@array)\n    $min= min_heap_adjust_top(@array)\n    $maxstr= maxstr_heap_adjust_top(@array)\n    $minstr= minstr_heap_adjust_top(@array)\n        If the weight of the top item in a heapified array ($array[0]) has\n        changed, this function will adjust its position in the tree, and\n        return the resulting new \"top\" (min/max) value.\n\n    $max= max_heap_adjust_item(@array,$idx)\n    $min= min_heap_adjust_item(@array,$idx)\n    $maxstr= maxstr_heap_adjust_item(@array,$idx)\n    $minstr= minstr_heap_adjust_item(@array,$idx)\n        If the weight of a specific item in a heapified array has changed,\n        this function will adjust its position in the tree, and return the\n        resulting new \"top\" (min/max) value. If $idx is outside the array\n        does nothing.\n\n    $idx= heap_parent_idx($idx)\n        Returns the defined location for the node residing at index $idx in\n        a heap, or undef if the $idx is 0.\n\n    $idx= heap_left_child_idx($idx)\n    $idx= heap_right_child_idx($idx)\n        Returns the defined location for the children of a node residing at\n        index $idx in a heap.\n\nVERSION\n    This is version 0.04\n\nINSTALLATION\n    To install this module type the following:\n\n       perl Makefile.PL\n       make\n       make test\n       make install\n\nDEPENDENCIES\n    This module is implemented in XS, and requires a working C compiler and\n    Perl build tools environment to build.\n\nSEE ALSO\n    CPAN - There are other heap packages with different interfaces if you\n    don't like this one.\n\nAUTHOR\n    Yves Orton, \u003cdemerph@(that google thingee)\u003e\n\nCOPYRIGHT AND LICENSE\n    Copyright (C) 2018 by Yves Orton\n\n    This software is released under the \"MIT License\".\n\n    See the file LICENSE.txt for more specifics.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemerphq%2Falgorithm-heapify-xs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdemerphq%2Falgorithm-heapify-xs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemerphq%2Falgorithm-heapify-xs/lists"}