Skip to content

Commit 0bff58a

Browse files
committed
✨ feat: refactor binary-index-tree
1 parent 2ebf9a8 commit 0bff58a

16 files changed

+574
-845
lines changed

Diff for: MIGRATION.md

+19
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,22 @@ No breaking changes.
4141
dist: ReadonlyArray<C>
4242
}
4343
```
44+
45+
46+
### @algorithm.ts/binary-index-tree
47+
48+
1. `createBinaryIndexTree1` is removed, use `SingleUpdateIntervalQuery` instead.
49+
2. `createBinaryIndexTree2` is removed, use `SingleUpdateIntervalQuery` instead.
50+
3. No builtin modulo binary index tree, perform the modulus operations through customized `add`
51+
method:
52+
53+
```typescript
54+
import { SingleUpdateIntervalQuery } from '@algorithm.ts/binary-index-tree'
55+
const MOD = 1e9 + 7
56+
const bit = SingleUpdateIntervalQuery<number>({
57+
operator: {
58+
ZERO: 0,
59+
add: (x, y) => ((x + y) % MOD + MOD) % MOD,
60+
},
61+
})
62+
```

Diff for: packages/binary-index-tree/README-zh.md

-234
This file was deleted.

0 commit comments

Comments
 (0)