No video

Segment Tree: Build and Query | Live Coding..

  Рет қаралды 102,010

take U forward

take U forward

Күн бұрын

Check our Website:
In case you are thinking to buy courses, please check below:
Link to get 20% additional Discount at Coding Ninjas: bit.ly/3wE5aHx
Code "takeuforward" for 15% off at GFG: practice.geeksforgeeks.org/co...
Code "takeuforward" for 20% off on sys-design: get.interviewready.io?_aff=takeuforward
Crypto, I use the Wazirx app: wazirx.com/invite/xexnpc4u
Take 750 rs free Amazon Stock from me: indmoney.onelink.me/RmHC/idje...
Earn 100 rs by making a Grow Account for investing: app.groww.in/v3cO/8hu879t0
Linkedin/Instagram/Telegram: linktr.ee/takeUforward
---------------------------------------------------------------------------------------------------------------------------------------------------- In this video, the Segment Tree Data Structure has been discussed.
Please donate to save someone's life: www.ketto.org/fundraiser/i-ne...
Proof: www.quora.com/Why-does-4-*-N-...
Striver's Linkedin Profile: / rajarvp
Instagram(I reply mostly here): / striver_79
Connect with us: t.me/Competitive_Programming_tuf (Use Link in Mobile only)
#FundRaiser #SegmentTree #Tutorial

Пікірлер: 107
@deepakchawla1105
@deepakchawla1105 4 жыл бұрын
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 .
@abhisekmohanty7386
@abhisekmohanty7386 4 жыл бұрын
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.
@akshatpriyansh1818
@akshatpriyansh1818 2 жыл бұрын
Super clear explanation. Loved the structure and the flow, keep it up.
@devanshmesson2777
@devanshmesson2777 2 жыл бұрын
Such a nice explanation on Segment Trees, You just removed my fear of Segment Trees! Thank you so much Striver!
@ankitsingh-rb8pc
@ankitsingh-rb8pc 3 жыл бұрын
best segment tree lecture i can find. i was trying to learn it from last year
@rohansharma4065
@rohansharma4065 3 жыл бұрын
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
@harinijaan3779
@harinijaan3779 2 жыл бұрын
You are the best. Clearly explained
@lifeofasoftwareengg...930
@lifeofasoftwareengg...930 2 жыл бұрын
Fantastic explanation!!
@deepakchawla1105
@deepakchawla1105 4 жыл бұрын
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 .
@simardeepsinghmudhar7065
@simardeepsinghmudhar7065 3 ай бұрын
What a great coder, i hope he gets into a good mnc such as google, keep it up 👍
@prashantshukla6870
@prashantshukla6870 Жыл бұрын
The way you explain was absolutely great.
@_PixelPioneer_
@_PixelPioneer_ 2 ай бұрын
kehna kya chahte ho hindi me bolo
@aligohar1708
@aligohar1708 Жыл бұрын
So on point, loved it
@itz_me_imraan02
@itz_me_imraan02 3 жыл бұрын
One who explains tough concepts easily... 🔥
@rakesh8829
@rakesh8829 3 жыл бұрын
I personally felt this is the best video by striver. Thank u Striver :)
@GauravKumar-by1yt
@GauravKumar-by1yt 4 жыл бұрын
Love your video...nice gesture
@chandrashekarv.t7981
@chandrashekarv.t7981 3 жыл бұрын
No words to say .......He is the Absolute Best !
@ShubhamSHARMA-oi4xf
@ShubhamSHARMA-oi4xf 4 жыл бұрын
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.
@yashgoyal6079
@yashgoyal6079 2 жыл бұрын
Wonderful Explanation 👌
@raj_kundalia
@raj_kundalia Жыл бұрын
Amazing explanation!
@shensean1784
@shensean1784 2 жыл бұрын
Thank u. Nice explanation and good code demo.
@lofibeats2344
@lofibeats2344 Жыл бұрын
Please continue uploading about advanced DSA
@divyanshdixit4944
@divyanshdixit4944 4 жыл бұрын
Nice video. Please upload lazy propagation too.
@sysfailureexe6038
@sysfailureexe6038 Ай бұрын
Thank youu !!
@ramtiwari4727
@ramtiwari4727 3 жыл бұрын
keep it up......great video on segment tree...
@takeUforward
@takeUforward 3 жыл бұрын
Thanks a ton
@shriyasripuram529
@shriyasripuram529 4 жыл бұрын
Now, this is best content! Thank you sir.
@codingwithsam4992
@codingwithsam4992 Жыл бұрын
how is segment tree different or useful from sparse table? I want to edit any value in logn time.
@chaitanyakumar9229
@chaitanyakumar9229 3 жыл бұрын
This is the best and the simplest explanation i saw !!
@siddhantdash4955
@siddhantdash4955 2 жыл бұрын
great one..
@sachingoyal7443
@sachingoyal7443 3 жыл бұрын
Excellent.. One of the best and precise explanation. Thank you 😊😊
@dheeraj3281
@dheeraj3281 3 жыл бұрын
Crystal clear explanation! Thanks bro!
@suhaanbhandary4009
@suhaanbhandary4009 Жыл бұрын
Understood!!
@kunalgulati3358
@kunalgulati3358 2 жыл бұрын
great video
@rohitrout6450
@rohitrout6450 2 жыл бұрын
what about update_query_on_a_given_range?
@gunratnamore4250
@gunratnamore4250 2 жыл бұрын
Perfect :)
@DharanAditya
@DharanAditya 4 жыл бұрын
Good initiative bro. I dontated my Part. Keep inspiring Us.
@ztrixx3280
@ztrixx3280 4 жыл бұрын
Crystal clear explanation..✔️💯
@subhadeepdas8701
@subhadeepdas8701 2 жыл бұрын
Very nice explanation
@nightmare_9
@nightmare_9 3 жыл бұрын
Amazing man !! Just an amazing explanation
@m.s.nabhiram1532
@m.s.nabhiram1532 4 жыл бұрын
Thanks
@vaibhavsethia70
@vaibhavsethia70 3 жыл бұрын
Clean explanation!! Understood in 1 go. Thanks..
@AceHardy
@AceHardy 4 жыл бұрын
👑
@soumyadeepdutta6759
@soumyadeepdutta6759 Жыл бұрын
where do I get this code?
@Code_Note
@Code_Note 4 жыл бұрын
bro can u please tell is it possible to return the index of the maximum element within a given range??
@takeUforward
@takeUforward 4 жыл бұрын
store in terms of pair
@mukulasija4501
@mukulasija4501 Жыл бұрын
Thankyou..
@sagardhandhalya2067
@sagardhandhalya2067 3 жыл бұрын
Segment Tree use to scare me but not anymore , thank you. this video deserves more like.
@prernapundir8020
@prernapundir8020 4 жыл бұрын
Really appreciable...thanks a lot sir.
@sainathsingineedi2922
@sainathsingineedi2922 4 жыл бұрын
Really nice gesture from you❤️
@sumitmahato1341
@sumitmahato1341 4 жыл бұрын
Please made some video on javascript.
@jethalalnhk2409
@jethalalnhk2409 4 жыл бұрын
you haven't write function for update operation
@showsshorts4696
@showsshorts4696 Жыл бұрын
great sir
@utsavsingh899
@utsavsingh899 4 жыл бұрын
What are you using to "write" on the screen?
@takeUforward
@takeUforward 4 жыл бұрын
Digital pad
@arujbansal
@arujbansal 4 жыл бұрын
take U forward Can you recommend one to buy? Not too expensive
@takeUforward
@takeUforward 4 жыл бұрын
Wacom
@technologybaba192
@technologybaba192 Ай бұрын
Understood
@Ajay-ju2ig
@Ajay-ju2ig 4 жыл бұрын
We use array for storing value in segment tree .It is possible some index in middle of the array is empty?
@takeUforward
@takeUforward 4 жыл бұрын
Yeah might be..
@ojasdighe991
@ojasdighe991 2 жыл бұрын
but we will never access it
@ojasdighe991
@ojasdighe991 2 жыл бұрын
and won't ever have to
@eshandhok2591
@eshandhok2591 Жыл бұрын
@@ojasdighe991 Nice meeting you here mamu
@p38_amankuldeep75
@p38_amankuldeep75 Жыл бұрын
understood❤❤❤
@vishalsingh1295
@vishalsingh1295 3 жыл бұрын
Thanks for saving time
@takeUforward
@takeUforward 3 жыл бұрын
Happy to help
@yashdeore473
@yashdeore473 3 жыл бұрын
LIT
@rishabhkumar8115
@rishabhkumar8115 2 жыл бұрын
great video sir ji
@burhanuddinsadikot4300
@burhanuddinsadikot4300 3 жыл бұрын
Dude you are just awesome👍🏻, thanks
@shivabansfore7510
@shivabansfore7510 4 жыл бұрын
Daa after this plz make video on lazy propogation there is no proper video on youtube..
@tarunsinha8964
@tarunsinha8964 3 жыл бұрын
The best explanation!
@suryaprakashkalyanam3186
@suryaprakashkalyanam3186 5 ай бұрын
❤❤❤
@priyanshusrivastava2145
@priyanshusrivastava2145 Жыл бұрын
Striver is Legend For a Reason
@sadhunarun7430
@sadhunarun7430 3 жыл бұрын
very interesting topic well explained bro :D
@_wolvox
@_wolvox 4 жыл бұрын
Can you please make a video on range update query also!
@takeUforward
@takeUforward 4 жыл бұрын
yeah i will
@atiabjobayer
@atiabjobayer 3 жыл бұрын
@@takeUforward did you make one?
@shadabfaizal
@shadabfaizal 3 жыл бұрын
bhai maza aa gya video dekh kr
@AnkitKumar-mb4vl
@AnkitKumar-mb4vl 4 жыл бұрын
Very nicely explained👍
@pulkitjain5159
@pulkitjain5159 Жыл бұрын
bahi maja agya , kya explain kiya hai
@MANASDEWARIMVCS
@MANASDEWARIMVCS Жыл бұрын
osm
@koocheukkeijacky9704
@koocheukkeijacky9704 3 жыл бұрын
Thank you sooo much sir!!
@pratikthakur9016
@pratikthakur9016 4 жыл бұрын
Hi frist
@vedantvalsangkar2091
@vedantvalsangkar2091 3 жыл бұрын
Simply awesome
@mainakmondal5228
@mainakmondal5228 Жыл бұрын
US
@Joel-px2yy
@Joel-px2yy 5 ай бұрын
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); } }
@shashwatsingh1892
@shashwatsingh1892 4 жыл бұрын
Hey striver tell them not to keep any prize money for the contest and keep tell them to donate entry fees for the same
@ShubhamSHARMA-oi4xf
@ShubhamSHARMA-oi4xf 4 жыл бұрын
Entry fees will be donated.
@tecHSonic
@tecHSonic 4 жыл бұрын
Which software or pen table do you use for making videos?
@mohitgarg7070
@mohitgarg7070 4 жыл бұрын
*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*
@ShubhamSHARMA-oi4xf
@ShubhamSHARMA-oi4xf 4 жыл бұрын
Okay we will look into it thanks for your suggestion/concern.
@munvut877
@munvut877 2 ай бұрын
@@ShubhamSHARMA-oi4xf what happened to that boy is he okay now?
@vaalarivan_p
@vaalarivan_p Жыл бұрын
0:00 - 7:05 9:17 - 12:04
@adityapandey2514
@adityapandey2514 3 жыл бұрын
just awesome 3000
@pratikkundnani
@pratikkundnani 4 жыл бұрын
Do product based companies ask segment tree questions?
@takeUforward
@takeUforward 4 жыл бұрын
NO
@AbhishekPandey-yl3bp
@AbhishekPandey-yl3bp Жыл бұрын
@@takeUforward Google did
@munvut877
@munvut877 2 ай бұрын
3 years after now it became a regular question
@dayanandraut5660
@dayanandraut5660 2 жыл бұрын
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.
@GuitarCoversByRavi
@GuitarCoversByRavi 2 жыл бұрын
Isn't it the same as space taken in seg[ ] array, i. e. 4*n
@noobplays6673
@noobplays6673 2 жыл бұрын
@@GuitarCoversByRavi it should be 2n-1
@skt7088
@skt7088 3 жыл бұрын
Please also make a video on sparse table data structure
@harshsrivastava5124
@harshsrivastava5124 4 жыл бұрын
aye su che
@sjgghosh7677
@sjgghosh7677 3 жыл бұрын
wasn't this supposed to be one of the toughest concepts :(
@jethalalnhk2409
@jethalalnhk2409 4 жыл бұрын
i thought its a very hard topic but its easy but times consuming during contest
@safalyaghoshroy2405
@safalyaghoshroy2405 4 жыл бұрын
First comment!!!
Understanding B-Trees: The Data Structure Behind Modern Databases
12:39
Llegó al techo 😱
00:37
Juan De Dios Pantoja
Рет қаралды 59 МЛН
Mama vs Son vs Daddy 😭🤣
00:13
DADDYSON SHOW
Рет қаралды 49 МЛН
Segment Tree Range Minimum Query
27:44
Tushar Roy - Coding Made Simple
Рет қаралды 273 М.
Why The Windows Phone Failed
24:08
Apple Explained
Рет қаралды 226 М.
5 Simple Steps for Solving Dynamic Programming Problems
21:27
Reducible
Рет қаралды 1 МЛН
Sparse Table & RMQ (Range Minimum Query)
18:42
Errichto Algorithms
Рет қаралды 74 М.
L11. Aestroid Collisions | Stack and Queue Playlist
17:28
take U forward
Рет қаралды 3,9 М.
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 633 М.
Github - You Can View Deleted Private Fork Data
23:40
ThePrimeTime
Рет қаралды 50 М.