You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file implements a Binary Trie (01-Trie) data structure for efficiently storing and querying binary representations of integers. It supports insertion, minimum/maximum XOR queries, and range queries with upper bounds.
This file provides the Mess class, a utility for discretizing values in a vector, mapping them to a compact index range. It supports insertion, initialization, querying, and checking existence of values.
11
9
12
10
## Usage Example
13
11
14
-
```cpp
15
-
#include"discretization.hpp"
16
-
std::vector<int> a = {100, 200, 100};
17
-
Mess<int> mess(a);
18
-
int idx = mess.query(200); // 查询 200 离散化后的编号
19
-
```
20
-
21
12
```cpp
22
13
#include"discretization.hpp"
23
14
std::vector<int> a = {5, 2, 7};
@@ -26,25 +17,18 @@ int idx = mess.query(5); // Get discrete index of 5
This file implements a cancelable Disjoint Set Union (DSU) data structure, also known as a union-find with rollback. It supports merging sets, checking connectivity, and undoing previous merge operations efficiently.
11
9
12
10
## Usage Example
@@ -15,14 +13,10 @@ This file implements a cancelable Disjoint Set Union (DSU) data structure, also
15
13
#include"cancel-dsu.hpp"
16
14
CancelDSU dsu(5);
17
15
dsu.merge(1, 2);
18
-
dsu.cancel(); // 撤销上一次合并
19
16
dsu.cancel(); // Undo last merge
20
17
```
21
18
22
19
## Main Features
23
-
- 支持撤销合并操作
24
-
- 支持集合大小查询
25
-
- 适合可回溯并查集场景
26
20
- Supports union, find, and size queries
27
21
- Allows rollback (cancel) of previous merge operations
28
22
- Maintains history using a stack
@@ -31,11 +25,10 @@ dsu.cancel(); // Undo last merge
0 commit comments