{"id":21165634,"url":"https://github.com/dong50252409/mini_heap","last_synced_at":"2025-03-14T16:43:53.180Z","repository":{"id":220101904,"uuid":"374367961","full_name":"dong50252409/mini_heap","owner":"dong50252409","description":"Minimum heap based on maps implementation","archived":false,"fork":false,"pushed_at":"2024-08-17T02:52:20.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-21T10:09:29.670Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dong50252409.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-06T13:30:31.000Z","updated_at":"2024-08-17T02:52:23.000Z","dependencies_parsed_at":"2024-01-31T10:28:35.621Z","dependency_job_id":"d259f771-3d67-4993-8be3-a17c7ac01293","html_url":"https://github.com/dong50252409/mini_heap","commit_stats":null,"previous_names":["dong50252409/mini_heap"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dong50252409%2Fmini_heap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dong50252409%2Fmini_heap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dong50252409%2Fmini_heap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dong50252409%2Fmini_heap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dong50252409","download_url":"https://codeload.github.com/dong50252409/mini_heap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243615141,"owners_count":20319723,"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-20T14:43:56.365Z","updated_at":"2025-03-14T16:43:53.158Z","avatar_url":"https://github.com/dong50252409.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"mini_heap\n=====\n\n基于maps结构实现的最小堆，提供elem_heap和kv_heap两种实现\n\n    elem_heap.erl\n    new/0               % O(1)\n    add_element/2       % O(log n)\n    take_element/1      % O(log n)\n    size/1              % O(1)\n    from_list/1         % O(1)\n    \n    vk_heap.erl\n    new/0               % O(1)\n    insert/3            % O(log n)\n    take_value/1        % O(log n)\n    size/1              % O(1)\n    from_list/1         % O(1)\n\n如何使用\n-----\n`elem_heap.erl`使用例子\n\n    $ rebar3 shell\n\n    Eshell V11.0  (abort with ^G)\n    1\u003e L = [79, 62, 73, 90, 66, 32, 58, 39, 26, 19].\n    [79, 62, 73, 90, 66, 32, 58, 39, 26, 19]\n    2\u003e MiniHeap = elem_heap:from_list(L).\n    {11,#{1 =\u003e 19,2 =\u003e 26,3 =\u003e 58,4 =\u003e 39,5 =\u003e 32,...}}\n    7\u003e {Elem, MiniHeap1} = elem_heap:take_element(MiniHeap).\n    {19,{10,#{1 =\u003e 26,2 =\u003e 32,3 =\u003e 58,4 =\u003e 39,5 =\u003e 79,...}}}\n    4\u003e Elem.\n    19\n    5\u003e MiniHeap2 = elem_heap:add_element(50, MiniHeap1).\n    {11,#{1 =\u003e 26,2 =\u003e 32,3 =\u003e 58,4 =\u003e 39,5 =\u003e 50,...}}\n    6\u003e {Elem2, MiniHeap3} = elem_heap:take_element(MiniHeap2).\n    {26,{10,#{1 =\u003e 32,2 =\u003e 39,3 =\u003e 58,4 =\u003e 66,5 =\u003e 50,...}}}\n    7\u003e Elem2.\n    26\n    8\u003e elem_heap:size(MiniHeap3).\n    9\n\n`kv_heap.erl`使用例子\n\n    $ rebar3 shell\n\n    Eshell V11.0  (abort with ^G)\n    1\u003e L = [{79, 1}, {62, 2}, {73, 3}, {90, 4}, {66, 5}, {32, 6}, {58, 7}, {39, 8}, {26, 9}, {19, 10}].\n    [{79,1}, {62,2}, {73,3}, {90,4}, {66,5}, {32,6}, {58,7}, {39,8}, {26,9}, {19,10}]\n    2\u003e MiniHeap = kv_heap:from_list(L).\n    {11,#{1 =\u003e {19,10},2 =\u003e {26,9},3 =\u003e {58,7},4 =\u003e {39,8},5 =\u003e {32,6},...}}\n    3\u003e {Value, MiniHeap1} = kv_heap:take_value(MiniHeap).\n    {10,{10,#{1 =\u003e {26,9},2 =\u003e {32,6},3 =\u003e {58,7},4 =\u003e {39,8},5 =\u003e {79,1},...}}}\n    4\u003e Value.\n    10\n    5\u003e MiniHeap2 = kv_heap:insert(50, 50, MiniHeap1).      \n    {11,#{1 =\u003e {26,9},2 =\u003e {32,6},3 =\u003e {58,7},4 =\u003e {39,8},5 =\u003e {50,50},...}}\n    6\u003e {Value2, MiniHeap3} = kv_heap:take_value(MiniHeap2).\n    {9,{10,#{1 =\u003e {32,6},2 =\u003e {39,8},3 =\u003e {58,7},4 =\u003e {66,5},5 =\u003e {50,50},...}}}\n    7\u003e Value2.\n    9\n    8\u003e kv_heap:size(MiniHeap3).\n    9\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdong50252409%2Fmini_heap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdong50252409%2Fmini_heap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdong50252409%2Fmini_heap/lists"}