Skip to content

Commit 10c7a44

Browse files
author
agribeau
committed
feat(segment tree): Add method of getting the size of the tree
1 parent 744a38f commit 10c7a44

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/data_structure/tree/segment_tree/SegmentTree.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,11 @@ public SegmentTree(E[] arr) {
1414
tree = (E[]) new Object[4 * arr.length];
1515
}
1616

17+
/**
18+
* 获取线段树的大小
19+
*/
20+
public int size() {
21+
return data.length;
22+
}
23+
1724
}

0 commit comments

Comments
 (0)