I am getting conflicting evidence on the build time complexity for a recursive segment tree.
Some sources(wikipedia) claim it's O(N*log(N)), while others claim it's O(N). My intuition says it's O(N), because we have 2N nodes and 2N-1 edges.
Which one is it?
Note: We're building the segment tree with a function like such:
private int build(int[] a, int i, int l, int r){
if(l == r){
nodes[i] = a[l];
}else{
nodes[i] = Math.min(build(a, i*2, l, (l+r)/2),
build(a, i*2+1, (l+r)/2+1, r));
}
return nodes[i];
}
we're not doing point update for each value in the array.