Skip to content

Instantly share code, notes, and snippets.

@sazid
Last active June 17, 2018 22:51
Show Gist options
  • Save sazid/66d602060882ba88ee276ffe2c3ec3fe to your computer and use it in GitHub Desktop.
Save sazid/66d602060882ba88ee276ffe2c3ec3fe to your computer and use it in GitHub Desktop.
// arr[] = {4, 2, 3, 8, 1, 9}
// tree[]
// build(...)
// query(...)
// update(...)
int main() {
// 1 দিয়ে রুট নোড বুঝনো হয়েছে
build(1, 1, MX);
// [2, 5] রেঞ্জ কুয়েরি করবো
cout << query(1, 1, MX, 2, 5) << endl;
// 3 নম্বর ইন্ডেক্সটি আপডেট করে 10 সেট করবো
update(1, 1, MX, 3, 10);
cout << query(1, 1, MX, 2, 5) << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment