Skip to content

Commit 4babcfa

Browse files
lrvideckisweb-flowcameroncuster
authored
less member variables (#10)
* less member variablesg * [auto-verifier] verify commit 08a88b0 --------- Co-authored-by: Luke Videckis <lukevideckis@gmail.com> Co-authored-by: GitHub <noreply@github.com> Co-authored-by: Cameron Custer <73217097+cameroncuster@users.noreply.github.com>
1 parent 8525b67 commit 4babcfa

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +0,0 @@
1-
{
2-
"examples/point_add_range_sum.rs": "2024-05-15 22:56:06 -0600",
3-
"examples/shortest_path.rs": "2024-05-15 22:56:06 -0600",
4-
"examples/staticrmq.rs": "2024-05-15 22:56:06 -0600",
5-
"examples/unionfind.rs": "2024-05-15 22:56:06 -0600"
6-
}

src/fenwick.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
pub struct Fenwick<T> {
2-
n: usize,
32
ary: Vec<T>,
43
}
54
impl<T: Clone + Default + std::ops::AddAssign<T>> Fenwick<T> {
65
pub fn new(n: usize) -> Self {
76
Fenwick {
8-
n,
97
ary: vec![T::default(); n],
108
}
119
}
@@ -22,7 +20,7 @@ impl<T: Clone + Default + std::ops::AddAssign<T>> Fenwick<T> {
2220
where
2321
T: std::ops::AddAssign<U>,
2422
{
25-
while idx < self.n {
23+
while idx < self.ary.len() {
2624
self.ary[idx] += val.clone();
2725
idx |= idx + 1;
2826
}

0 commit comments

Comments
 (0)