/**
* Definition of SegmentTreeNode:
* class SegmentTreeNode {
* public:
* int start, end, max;
* SegmentTreeNode *left, *right;
* SegmentTreeNode(int start, int end, int max) {
* this->start = start;
* this->end = end;
* this->max = max;
* this->left = this->right = NULL;
* }
* }
*/
class Solution {
public:
void modify(SegmentTreeNode *root, int index, int value) {
if(!root)
return ;
if(root->start==root->end){
if(root->start==index)
root->max=value;
return ;
}
modify(root->left,index,value);
modify(root->right,index,value);
root->max=max(root->left->max,root->right->max);
}
};