{"id":22161042,"url":"https://github.com/codeexmachina/btree","last_synced_at":"2025-08-12T16:38:47.090Z","repository":{"id":144130022,"uuid":"268687395","full_name":"CodeExMachina/BTree","owner":"CodeExMachina","description":"In-memory B-Tree implementation for C#","archived":false,"fork":false,"pushed_at":"2020-06-19T18:05:40.000Z","size":66,"stargazers_count":21,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-26T13:40:52.197Z","etag":null,"topics":["b-tree","btree","csharp","memory-btree","netstandard"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodeExMachina.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":"2020-06-02T03:00:24.000Z","updated_at":"2025-05-19T12:04:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"576e17b6-a974-4262-a29d-18cfa9e6375d","html_url":"https://github.com/CodeExMachina/BTree","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/CodeExMachina/BTree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeExMachina%2FBTree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeExMachina%2FBTree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeExMachina%2FBTree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeExMachina%2FBTree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeExMachina","download_url":"https://codeload.github.com/CodeExMachina/BTree/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeExMachina%2FBTree/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270099050,"owners_count":24527024,"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-08-12T02:00:09.011Z","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":["b-tree","btree","csharp","memory-btree","netstandard"],"created_at":"2024-12-02T04:12:54.785Z","updated_at":"2025-08-12T16:38:47.078Z","avatar_url":"https://github.com/CodeExMachina.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# BTree implementation for C#\n\n![Travis CI Build Status](https://travis-ci.org/CodeExMachina/BTree.svg?branch=master)\n\nThis package provides an in-memory B-Tree implementation for C#, useful as\nan ordered, mutable data structure.\n\nThe code and API are inspired by Google's excellent [Go implementation](https://github.com/google/btree).\n\n## Installation\n\nInstall with [NuGet](https://www.nuget.org/packages/CodeExMachina.BTree/):\n\n    Install-Package CodeExMachina.BTree\n    \nOr via the .NET Core command line interface:\n\n    dotnet add package CodeExMachina.BTree\n\nSee [API](API.md) for documentation.\n\n## Example\n```C#\nclass Integer  \n{\n    private readonly int _v;\n\n    public int Value =\u003e _v;\n\n    public Integer(int v)\n    {\n        _v = v;\n    }\n\n    public override string ToString() =\u003e _v.ToString();             \n}\n\n// The Comparer must provide a strict weak ordering.\n//\n// If !(x \u003c y) and !(y \u003c x), we treat this to mean x == y \n// (i.e. we can only hold one of either x or y in the tree).\n\nclass IntegerComparer : Comparer\u003cInteger\u003e\n{\n    public override int Compare(Integer x, Integer y)\n    {\n        return x.Value \u003c y.Value ? -1 : x.Value \u003e y.Value ? 1 : 0;\n    }\n}\n\nconst int BTreeDegree = 32;\n\nvar tr = new BTree\u003cInteger\u003e(32, new IntegerComparer());\n\nfor (int i = 0; i \u003c 10; i++)\n{\n    _ = tr.ReplaceOrInsert(new Integer(i));\n}\n\nConsole.WriteLine(\"len:       {0}\", tr.Length);\nConsole.WriteLine(\"get3:      {0}\", tr.Get(new Integer(3)));\nConsole.WriteLine(\"get100:    {0}\", tr.Get(new Integer(100)));\nConsole.WriteLine(\"del4:      {0}\", tr.Delete(new Integer(4)));\nConsole.WriteLine(\"del100:    {0}\", tr.Delete(new Integer(100)));\nConsole.WriteLine(\"replace5:  {0}\", tr.ReplaceOrInsert(new Integer(5)));\nConsole.WriteLine(\"replace100:{0}\", tr.ReplaceOrInsert(new Integer(100)));\nConsole.WriteLine(\"min:       {0}\", tr.Min());\nConsole.WriteLine(\"delmin:    {0}\", tr.DeleteMin());\nConsole.WriteLine(\"max:       {0}\", tr.Max());\nConsole.WriteLine(\"delmax:    {0}\", tr.DeleteMax());\nConsole.WriteLine(\"len:       {0}\", tr.Length);\n\n// Output:\n// len:        10\n// get3:       3\n// get100:     \n// del4:       4\n// del100:     \n// replace5:   5\n// replace100: \n// min:        0\n// delmin:     0\n// max:        100\n// delmax:     100\n// len:        8\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeexmachina%2Fbtree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeexmachina%2Fbtree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeexmachina%2Fbtree/lists"}