Skip to content

Commit 40b9db7

Browse files
authored
Update Binary_Indexed_Tree.java
1 parent 90289ce commit 40b9db7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Data Structures/Binary_Indexed_Tree.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
public class Binary_Indexed_Tree {
22

33
public static void main(String[] args) throws IOException {
4-
//testting BIT
4+
//testting BIT
55
BIT bit = new BIT(12);
66
bit.update(4, 1);
77
bit.update(3, 1);
@@ -22,12 +22,12 @@ public BIT(int n){
2222
binary_indexed_tree = new int[++n];
2323
maxVal = n;
2424
}
25-
26-
public void update(int index, int val){
27-
while (index <= maxVal){
28-
tree[index] += val;
29-
index += (index & -index); //last bit removal
30-
}
25+
26+
public void update(int index, int val){
27+
while (index <= maxVal){
28+
tree[index] += val;
29+
index += (index & -index); //last bit removal
30+
}
3131
}
3232

3333
//Returns the cumulative frequency of index index

0 commit comments

Comments
 (0)