segment trees questions added#10
Conversation
|
Hello @Manish2397, This seems to be code for segment trees. Your PR is labeled as questions for segment trees. |
|
Hello @Manish2397 , thanks for contributing. Can you please move the Segment tree folder to Data Structures/ Advanced DS/ Segment Trees instead of the root folder so as to follow the structure described in README? We would also like you to provide a more thorough documentation of the code, as also indicated by @papachristoumarios. Lastly, instead of implementing 2 segment trees (one for min/max querries and one for range sum querries) you could implement 1 generic segment tree that works with a function f ( |
| //right subTree | ||
| buildSegmentTree(tree,values,2*index+1,mid+1,end); | ||
|
|
||
| tree[index] = tree[2*index]+tree[2*index+1]; |
There was a problem hiding this comment.
For example, in the generic segment tree described in my comment, line 22 would be:
tree[index] = f( tree[2*index], tree[2*index+1] );
Segment trees tutorial with question added.