Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sakapon authored Mar 19, 2022
1 parent a9b1c9e commit 3ab1320
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
Provides a basic implementation of weight-balanced binary trees.

The WBTrees library contains classes as follows:
- A list by a weight-balanced binary tree, with all `O(log n)` operations
- A list by a weight-balanced binary tree, with all `O(log n)` basic operations
- `WBList<T>`
- Weight-balanced binary search trees, which can be accessed by index in `O(log n)` time
- A set and a map by weight-balanced binary search trees, which can be accessed by index in `O(log n)` time
- `WBSet<T>`
- `WBMultiSet<T>`
- `WBMap<TKey, TValue>`
Expand All @@ -23,10 +23,10 @@ You are welcome to port this to other languages.
## Features

### A List by a Weight-Balanced Binary Tree
Provides the `WBList<T>` class as a list with all `O(log n)` operations.
You can also use a `WBList<T>` as a double-ended queue (deque).
Provides the `WBList<T>` class as a list with all `O(log n)` basic operations.
You can also use a `WBList<T>` as a (high-grade) double-ended queue (deque).

The following table compares time complexities of [`List<T>`](https://docs.microsoft.com/dotnet/api/system.collections.generic.list-1) and `WBList<T>`:
The following table compares time complexities of [`System.Collections.Generic.List<T>`](https://docs.microsoft.com/dotnet/api/system.collections.generic.list-1) and `WBList<T>`:
| Operation | `List<T>` | `WBList<T>` |
|:--|:-:|:-:|
| Get by Index | `O(1)` | `O(log n)` |
Expand All @@ -37,11 +37,11 @@ The following table compares time complexities of [`List<T>`](https://docs.micro
| Add | `O(1)` | `O(log n)` |
| Get All | `O(n)` | `O(n)` |

### Weight-Balanced Binary Search Trees
### A Set and a Map by Weight-Balanced Binary Search Trees
Provides the `WBSet<T>`, `WBMultiSet<T>`, `WBMap<TKey, TValue>` and `WBMultiMap<TKey, TValue>` classes, which can be accessed by index in `O(log n)` time. All these classes are derived from the `WBTreeBase<T>` class.
You can also use a `WBMultiSet<T>` or a `WBMultiMap<TKey, TValue>` as a priority queue with stable sorting.
You can also use a `WBMultiSet<T>` or a `WBMultiMap<TKey, TValue>` as a priority queue with stable sorting or a double-ended priority queue.

The following table compares time complexities of [`SortedSet<T>`](https://docs.microsoft.com/dotnet/api/system.collections.generic.sortedset-1) and `WBSet<T>`:
The following table compares time complexities of [`System.Collections.Generic.SortedSet<T>`](https://docs.microsoft.com/dotnet/api/system.collections.generic.sortedset-1) and `WBSet<T>`:
| Operation | `SortedSet<T>` | `WBSet<T>` |
|:--|:-:|:-:|
| Get by Item | `O(log n)` | `O(log n)` |
Expand All @@ -53,8 +53,8 @@ The following table compares time complexities of [`SortedSet<T>`](https://docs.
| Get All | `O(n)` | `O(n)` |

## Algorithm
Both `WBList<T>` and `WBTreeBase<T>` are weight-balanced binary trees.
The `Node<T>` class contains the `Count` property that contributes to both self-balancing and direct access by index (order).
Both `WBList<T>` and `WBTreeBase<T>` are weight-balanced binary trees (not necessarily searchable by items).
The `Node<T>` class contains the `Count` property that contributes to both self-balancing and fast access by index (order).

## Target Frameworks
- .NET 5
Expand All @@ -65,7 +65,7 @@ The `Node<T>` class contains the `Count` property that contributes to both self-
The WBTrees library is published to [NuGet Gallery](https://www.nuget.org/packages/WBTrees/).
Install the NuGet package via Visual Studio, etc.

You can also [download a single source file here](downloads), for competitive programming, etc.
You can also [download a single source file here](downloads) for competitive programming, etc.

## Usage
See [Usage on Wiki](https://github.com/sakapon/WBTrees/wiki/Usage) for coding.
Expand Down

0 comments on commit 3ab1320

Please sign in to comment.