{"id":13411732,"url":"https://github.com/igrmk/treemap","last_synced_at":"2025-04-30T15:50:44.131Z","repository":{"id":57497272,"uuid":"145481506","full_name":"igrmk/treemap","owner":"igrmk","description":"Generic sorted map for Go with red-black tree under the hood","archived":false,"fork":false,"pushed_at":"2022-03-22T05:03:27.000Z","size":71,"stargazers_count":58,"open_issues_count":2,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-31T20:48:40.628Z","etag":null,"topics":["container","go","golang","golang-library","golang-package","gotemplate","map","red-black-tree","sorted-map","tree-structure","treemap"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/igrmk.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}},"created_at":"2018-08-20T23:41:07.000Z","updated_at":"2024-07-18T21:29:26.000Z","dependencies_parsed_at":"2022-09-26T17:01:33.580Z","dependency_job_id":null,"html_url":"https://github.com/igrmk/treemap","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrmk%2Ftreemap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrmk%2Ftreemap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrmk%2Ftreemap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrmk%2Ftreemap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igrmk","download_url":"https://codeload.github.com/igrmk/treemap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251734546,"owners_count":21635155,"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":["container","go","golang","golang-library","golang-package","gotemplate","map","red-black-tree","sorted-map","tree-structure","treemap"],"created_at":"2024-07-30T20:01:16.298Z","updated_at":"2025-04-30T15:50:44.084Z","avatar_url":"https://github.com/igrmk.png","language":"Go","readme":"TreeMap v2\n==========\n\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/igrmk/treemap/v2)](https://pkg.go.dev/github.com/igrmk/treemap/v2)\n[![Unlicense](https://img.shields.io/badge/license-Unlicense-brightgreen.svg)](http://unlicense.org/)\n[![Build Status](https://api.travis-ci.com/igrmk/treemap.svg?branch=master)](https://app.travis-ci.com/github/igrmk/treemap)\n[![Coverage Status](https://coveralls.io/repos/igrmk/treemap/badge.svg?branch=master)](https://coveralls.io/github/igrmk/treemap)\n[![GoReportCard](https://goreportcard.com/badge/github.com/igrmk/treemap/v2)](https://goreportcard.com/report/github.com/igrmk/treemap/v2)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\n\n`TreeMap` is a generic key-sorted map using a red-black tree under the hood.\nIt requires and relies on [Go 1.18](https://tip.golang.org/doc/go1.18) generics feature.\nIterators are designed after C++.\n\n### Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/igrmk/treemap/v2\"\n)\n\nfunc main() {\n\ttr := treemap.New[int, string]()\n\ttr.Set(1, \"World\")\n\ttr.Set(0, \"Hello\")\n\tfor it := tr.Iterator(); it.Valid(); it.Next() {\n\t\tfmt.Println(it.Key(), it.Value())\n\t}\n}\n\n// Output:\n// 0 Hello\n// 1 World\n```\n\n### Install\n\n```bash\ngo get github.com/igrmk/treemap/v2\n```\n\n### Complexity\n\n|              Name              |   Time    |\n|:------------------------------:|:---------:|\n|             `Set`              | O(log*N*) |\n|             `Del`              | O(log*N*) |\n|             `Get`              | O(log*N*) |\n|           `Contains`           | O(log*N*) |\n|             `Len`              |   O(1)    |\n|            `Clear`             |   O(1)    |\n|            `Range`             | O(log*N*) |\n|           `Iterator`           |   O(1)    |\n|           `Reverse`            | O(log*N*) |\n| Iterate through the entire map |  O(*N*)   |\n\n### Memory usage\n\nTreeMap uses O(*N*) memory.\n\n### TreeMap v1\n\nThe previous version of this package used [gotemplate](https://github.com/ncw/gotemplate) library to generate a type specific file in your local directory.\nHere is the link to this version [treemap v1](https://github.com/igrmk/treemap/tree/v1.0.0).\n\n### Licensing\n\nCopyright \u0026copy; 2022 igrmk.\nThis work is free. You can redistribute it and/or modify it under the\nterms of the Unlicense. See the LICENSE file for more details.\n\n### Thanks to\n\n[![JetBrains](svg/jetbrains.svg)](https://www.jetbrains.com/?from=treemap)\n","funding_links":[],"categories":["Data Integration Frameworks","Data Structures and Algorithms","数据结构与算法","Generators"],"sub_categories":["Trees","树"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figrmk%2Ftreemap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figrmk%2Ftreemap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figrmk%2Ftreemap/lists"}