{"id":20646527,"url":"https://github.com/sakapon/wbtrees","last_synced_at":"2025-07-26T02:14:48.855Z","repository":{"id":42626033,"uuid":"461375642","full_name":"sakapon/WBTrees","owner":"sakapon","description":"Provides a basic implementation of weight-balanced binary trees.","archived":false,"fork":false,"pushed_at":"2022-06-10T14:43:46.000Z","size":253,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-17T09:45:11.218Z","etag":null,"topics":["algorithms","binary-search-tree","data-structures","self-balancing-binary-search-tree","weight-balanced-tree"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sakapon.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":"2022-02-20T03:39:59.000Z","updated_at":"2022-03-21T16:32:29.000Z","dependencies_parsed_at":"2022-09-07T22:52:26.676Z","dependency_job_id":null,"html_url":"https://github.com/sakapon/WBTrees","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sakapon%2FWBTrees","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sakapon%2FWBTrees/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sakapon%2FWBTrees/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sakapon%2FWBTrees/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sakapon","download_url":"https://codeload.github.com/sakapon/WBTrees/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242721296,"owners_count":20174799,"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":["algorithms","binary-search-tree","data-structures","self-balancing-binary-search-tree","weight-balanced-tree"],"created_at":"2024-11-16T16:26:09.475Z","updated_at":"2025-03-09T16:35:35.311Z","avatar_url":"https://github.com/sakapon.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WBTrees\n[![license](https://img.shields.io/github/license/sakapon/WBTrees.svg)](LICENSE)\n[![NuGet](https://img.shields.io/nuget/v/WBTrees.svg)](https://www.nuget.org/packages/WBTrees/)\n[![NuGet](https://img.shields.io/nuget/dt/WBTrees.svg)](https://www.nuget.org/packages/WBTrees/)\n\nProvides a basic implementation of weight-balanced binary trees.\n\nThe WBTrees library contains classes as follows:\n- A list by a weight-balanced binary tree, with all `O(log n)` basic operations\n  - `WBList\u003cT\u003e`\n- A set and a map by weight-balanced binary search trees, which can be accessed by index in `O(log n)` time\n  - `WBSet\u003cT\u003e`\n  - `WBMultiSet\u003cT\u003e`\n  - `WBMap\u003cTKey, TValue\u003e`\n  - `WBMultiMap\u003cTKey, TValue\u003e`\n\nAll these trees are constructed from `Node\u003cT\u003e` objects.\n\nSee [Wiki](https://github.com/sakapon/WBTrees/wiki) for more information.  \nThis library is written in C#.\nYou are welcome to port this to other languages.\n\n## Features\n\n### A List by a Weight-Balanced Binary Tree\nProvides the `WBList\u003cT\u003e` class as a list with all `O(log n)` basic operations.  \nYou can also use a `WBList\u003cT\u003e` as a (high-grade) double-ended queue (deque).\n\nThe following table compares time complexities of [`System.Collections.Generic.List\u003cT\u003e`](https://docs.microsoft.com/dotnet/api/system.collections.generic.list-1) and `WBList\u003cT\u003e`:\n| Operation | `List\u003cT\u003e` | `WBList\u003cT\u003e` |\n|:--|:-:|:-:|\n| Get by Index | `O(1)` | `O(log n)` |\n| Set by Index | `O(1)` | `O(log n)` |\n| Remove by Index | `O(n)` | `O(log n)` |\n| Insert by Index | `O(n)` | `O(log n)` |\n| Prepend | `O(n)` | `O(log n)` |\n| Add | `O(1)` | `O(log n)` |\n| Get All | `O(n)` | `O(n)` |\n\n### A Set and a Map by Weight-Balanced Binary Search Trees\nProvides the `WBSet\u003cT\u003e`, `WBMultiSet\u003cT\u003e`, `WBMap\u003cTKey, TValue\u003e` and `WBMultiMap\u003cTKey, TValue\u003e` classes, which can be accessed by index in `O(log n)` time. All these classes are derived from the `WBTreeBase\u003cT\u003e` class.  \nYou can also use a `WBMultiSet\u003cT\u003e` or a `WBMultiMap\u003cTKey, TValue\u003e` as a priority queue with stable sorting or a double-ended priority queue.\n\nThe following table compares time complexities of [`System.Collections.Generic.SortedSet\u003cT\u003e`](https://docs.microsoft.com/dotnet/api/system.collections.generic.sortedset-1) and `WBSet\u003cT\u003e`:\n| Operation | `SortedSet\u003cT\u003e` | `WBSet\u003cT\u003e` |\n|:--|:-:|:-:|\n| Get by Item | `O(log n)` | `O(log n)` |\n| Remove by Item | `O(log n)` | `O(log n)` |\n| Add | `O(log n)` | `O(log n)` |\n| Get by Index | `O(n)` | `O(log n)` |\n| Remove by Index | `O(n)` | `O(log n)` |\n| Get Index by Item | `O(n)` | `O(log n)` |\n| Get All | `O(n)` | `O(n)` |\n\n## Algorithm\nBoth `WBList\u003cT\u003e` and `WBTreeBase\u003cT\u003e` are weight-balanced binary trees (not necessarily searchable by items).\nThe `Node\u003cT\u003e` class contains the `Count` property that contributes to both self-balancing and fast access by index (order).\n\n## Target Frameworks\n- .NET 5\n- .NET Standard 2.0\n  - [.NET Core 2.0, .NET Framework 4.6.1, etc.](https://docs.microsoft.com/dotnet/standard/net-standard)\n\n## Setup\nThe WBTrees library is published to [NuGet Gallery](https://www.nuget.org/packages/WBTrees/).\nInstall the NuGet package via Visual Studio, etc.\n\nYou can also [download a single source file here](downloads) for competitive programming, etc.\n\n## Usage\nSee [Usage on Wiki](https://github.com/sakapon/WBTrees/wiki/Usage) for coding.\n\n## Release Notes\n- **v1.0.4** The first release.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsakapon%2Fwbtrees","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsakapon%2Fwbtrees","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsakapon%2Fwbtrees/lists"}