Striver you really won my heart bro.....The cause is really worth donating. And I surely would. Having said that would you please try to make videos on SPOJ problems like GSS1, GSS2, GSS3, GSS4 and some other good problems on segments trees, like I many times find problem figuring out the merging conditions and even the updates when we are dealing with tougher problems, Striver would be really happy if u try making them. I really appreciate this gesture of yours buddy.
Update Code based on the above video code- void add(vi&arr, int val,int tidx, int idx, int low, int high){ if(high == low && high == tidx){ seg[idx] += val; return; } seg[idx]+= val; int mid = (low+high)/2; if(tidx>=low && tidx=mid+1 && tidx
Really nice from you Striver . It would help him a lot . Continue your good work brother . The way you come forward to help others is really appreciable.
Bro, you missed the part on how to calculate the number of nodes in segment tree given the Array. That's one of the most important parts to understand when it comes to segment tree.
*Hey striver, we'll participate for sure but i have a request that whatever amount their college mates get, please tell them to donate all of that money directly to Tarun not through that ketto app because that fundraiser organisation charges 10% of whatever they make through that platform.* *Bold*
This is so great that our coders community is helping to save someone's life . A great fan of yours sir . This is highly appreciated .
Striver you really won my heart bro.....The cause is really worth donating. And I surely would. Having said that would you please try to make videos on SPOJ problems like GSS1, GSS2, GSS3, GSS4 and some other good problems on segments trees, like I many times find problem figuring out the merging conditions and even the updates when we are dealing with tougher problems, Striver would be really happy if u try making them.
I really appreciate this gesture of yours buddy.
best segment tree lecture i can find. i was trying to learn it from last year
Update Code based on the above video code-
void add(vi&arr, int val,int tidx, int idx, int low, int high){
if(high == low && high == tidx){
seg[idx] += val; return;
}
seg[idx]+= val;
int mid = (low+high)/2;
if(tidx>=low && tidx=mid+1 && tidx
What a great coder, i hope he gets into a good mnc such as google, keep it up 👍
No words to say .......He is the Absolute Best !
Such a nice explanation on Segment Trees, You just removed my fear of Segment Trees!
Thank you so much Striver!
I love the voice of this man. It sparks confidence.
Sir , It would be so great if you make a video on "How to stay motivated in CP and how to handle frustation" , i hope a lot of people need it .
Really nice from you Striver . It would help him a lot . Continue your good work brother . The way you come forward to help others is really appreciable.
Java code:
class SegmentTree {
static int arr[];
static int seg[];
static void build(int ind, int low, int high) {
if (low == high) {
seg[ind] = arr[low];
return;
}
int mid = low + ((high - low) / 2);
build(2 * ind + 1, low, mid);
build(2 * ind + 2, mid + 1, high);
seg[ind] = Math.max(seg[2 * ind + 1], seg[2 * ind + 2]);
}
static int findMax(int idx, int low, int high, int l, int r) {
if (low >= l && high r)
return Integer.MIN_VALUE;
int mid = low + ((high - low) / 2);
int left = findMax(2 * idx + 1, low, mid, l, r);
int right = findMax(2 * idx + 2, mid + 1, high, l, r);
return Math.max(left, right);
}
public static void main(String[] args) {
arr = new int[] { 8, 2, 5, 1, 4, 5, 3, 9, 6, 10 };
int n = arr.length;
seg = new int[n * 4];
build(0, 0, n - 1);
// System.out.println(Arrays.toString(seg));
int q1 = findMax(0, 0, n - 1, 1, 4);
int q2 = findMax(0, 0, n - 1, 3, 8);
int q3 = findMax(0, 0, n - 1, 4, n - 1);
System.out.println(q1 + " " + q2 + " " + q3);
}
}
The way you explain was absolutely great.
kehna kya chahte ho hindi me bolo
One who explains tough concepts easily... 🔥
Please continue uploading about advanced DSA
Super clear explanation. Loved the structure and the flow, keep it up.
Beautiful explanation. Thank you so much.
how is segment tree different or useful from sparse table?
I want to edit any value in logn time.
I personally felt this is the best video by striver.
Thank u Striver :)
You are the best. Clearly explained
what about update_query_on_a_given_range?
Segment Tree use to scare me but not anymore , thank you. this video deserves more like.
Nice video. Please upload lazy propagation too.
What are you using to "write" on the screen?
Digital pad
take U forward Can you recommend one to buy? Not too expensive
Wacom
where do I get this code?
Really nice gesture from you❤️
Thank youu !!
keep it up......great video on segment tree...
Thanks a ton
Now, this is best content!
Thank you sir.
Love your video...nice gesture
you haven't write function for update operation
bro can u please tell is it possible to return the index of the maximum element within a given range??
store in terms of pair
Amazing explanation!
Fantastic explanation!!
This is the best and the simplest explanation i saw !!
We use array for storing value in segment tree .It is possible some index in middle of the array is empty?
Yeah might be..
but we will never access it
and won't ever have to
@@ojasdighe991 Nice meeting you here mamu
Good initiative bro. I dontated my Part. Keep inspiring Us.
So on point, loved it
Daa after this plz make video on lazy propogation there is no proper video on youtube..
Can you please make a video on range update query also!
yeah i will
@@takeUforward did you make one?
Please made some video on javascript.
Thanks for saving time
Happy to help
Clean explanation!! Understood in 1 go. Thanks..
Wonderful Explanation 👌
Crystal clear explanation..✔️💯
Striver is Legend For a Reason
Excellent.. One of the best and precise explanation. Thank you 😊😊
Very nice explanation
Crystal clear explanation! Thanks bro!
Thanks
great sir
Thankyou..
Bro, you missed the part on how to calculate the number of nodes in segment tree given the Array. That's one of the most important parts to understand when it comes to segment tree.
Isn't it the same as space taken in seg[ ] array, i. e. 4*n
@@GuitarCoversByRavi it should be 2n-1
great one..
Understood
Understood!!
Really appreciable...thanks a lot sir.
Amazing man !! Just an amazing explanation
great video
*Hey striver, we'll participate for sure but i have a request that whatever amount their college mates get, please tell them to donate all of that money directly to Tarun not through that ketto app because that fundraiser organisation charges 10% of whatever they make through that platform.*
*Bold*
Okay we will look into it thanks for your suggestion/concern.
@@ShubhamSHARMA-oi4xf what happened to that boy is he okay now?
bahi maja agya , kya explain kiya hai
0:00 - 7:05
9:17 - 12:04
bhai maza aa gya video dekh kr
LIT
great video sir ji
Which software or pen table do you use for making videos?
The best explanation!
👑
Very nicely explained👍
Thank u. Nice explanation and good code demo.
understood❤❤❤
Perfect :)
Dude you are just awesome👍🏻, thanks
Hey striver tell them not to keep any prize money for the contest and keep tell them to donate entry fees for the same
Entry fees will be donated.
❤❤❤
Hi frist
Thank you sooo much sir!!
US
very interesting topic well explained bro :D
Simply awesome
osm
Do product based companies ask segment tree questions?
NO
@@takeUforward Google did
3 years after now it became a regular question
Please also make a video on sparse table data structure
just awesome 3000
aye su che
wasn't this supposed to be one of the toughest concepts :(
i thought its a very hard topic but its easy but times consuming during contest
First comment!!!