Skip to content

Commit c668f7a

Browse files
committed
minor changes
1 parent 3d4ca19 commit c668f7a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/data_structures/fenwick.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ Below, we get the sum of elements of $A$ in the range $[0, r]$ and update (incre
7070
```
7171
=== "Python"
7272
```py
73-
def sum(r: int):
73+
def sum(r: int) -> int:
7474
res = 0
7575
while (r >= 0):
7676
res += t[r]
7777
r = g(r) - 1
7878
return res
7979

80-
def increase(i: int, delta: int):
80+
def increase(i: int, delta: int) -> None:
8181
for all j with g(j) <= i <= j:
8282
t[j] += delta
8383
```
@@ -165,7 +165,7 @@ Also this implementation supports two constructors.
165165
You can create a Fenwick tree initialized with zeros, or you can convert an existing array into the Fenwick form.
166166

167167
=== "C++"
168-
```{.cpp file=fenwick_sum}
168+
```cpp
169169
struct FenwickTree {
170170
vector<int> bit; // binary indexed tree
171171
int n;
@@ -253,7 +253,7 @@ Additionally, each time a value is `update`'d, the new value has to be smaller t
253253
Both significant limitations are because the $min$ operation together with the set of integers doesn't form a group, as there are no inverse elements.
254254
255255
=== "C++"
256-
```{.cpp file=fenwick_min}
256+
```cpp
257257
struct FenwickTreeMin {
258258
vector<int> bit;
259259
int n;
@@ -436,7 +436,7 @@ As you can see, the main benefit of this approach is that the binary operations
436436
The following implementation can be used like the other implementations, however it uses one-based indexing internally.
437437
438438
=== "C++"
439-
```{.cpp file=fenwick_sum_onebased}
439+
```cpp
440440
struct FenwickTreeOneBasedIndexing {
441441
vector<int> bit; // binary indexed tree
442442
int n;

0 commit comments

Comments
 (0)