Skip to content

Commit 7d2e093

Browse files
committed
fix: align the order of Fenwicktree arguments with Segtree
1 parent 6acc2f7 commit 7d2e093

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/fenwicktree.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ const assert = std.debug.assert;
55
/// Fenwick Tree (Binary‑Indexed Tree)
66
/// Reference: https://en.wikipedia.org/wiki/Fenwick_tree
77
///
8-
/// This is a wrapper around a tree of element type T, identity e, and update operation op.
8+
/// This is a wrapper around a tree of element type T, update operation op, and identity e.
99
/// Initialize with `init`.
10-
pub fn FenwickTree(comptime T: type, comptime e: T, comptime op: fn (T, T) T) type {
10+
pub fn FenwickTree(comptime T: type, comptime op: fn (T, T) T, comptime e: T) type {
1111
return struct {
1212
const Self = @This();
1313
/// logical length of the array
1414
n: usize,
1515
/// internal 1‑based tree representation
1616
data: []T,
1717
allocator: Allocator,
18-
18+
1919
/// Creates an empty tree of length `n`, initialised with the identity.
2020
/// Deinitialize with `deinit`.
2121
///
@@ -95,10 +95,10 @@ pub fn FenwickTree(comptime T: type, comptime e: T, comptime op: fn (T, T) T) ty
9595
}
9696

9797
/// Convenient helper for i64 FenwickTree.
98-
pub const FenwickTreeI64 = FenwickTree(i64, 0, operation(i64).addition);
98+
pub const FenwickTreeI64 = FenwickTree(i64, operation(i64).addition, 0);
9999

100100
/// Convenient helper for i32 FenwickTree.
101-
pub const FenwickTreeI32 = FenwickTree(i32, 0, operation(i32).addition);
101+
pub const FenwickTreeI32 = FenwickTree(i32, operation(i32).addition, 0);
102102

103103
fn operation(comptime T: type) type {
104104
return struct {

0 commit comments

Comments
 (0)