Prefix Sum Algorithm | Prefix Sum Array | Difference Array | Range Sum QueryO(1) | EP2
ฝัง
- เผยแพร่เมื่อ 19 ก.ย. 2024
- Prefix sum algorithm is mainly used for range query and the complexity of prefix sum algorithm is O(n).
This video explains the working of prefix sum algorithm.
This is the second part of the video and please watch the first part (why you must learn prefix sum algorithm) before watching this.
✅ Why you must learn prefix sum algorithm part one link : • Why You Must Learn Pre...
🙋 Problem to solve : • Array Manipulation Hac...
🔴 Subscribe for more and hit the bell 🔔🔔🔔 icon to get video updates:
/ @javaaidtutorials
👍 Like us on Facebook: / hackerranksolutiontuto...
💎Share this video with a TH-camr friend: • Prefix Sum Algorithm |...
✚ Join our community ►
👉 Coding interview preparation group: / codingip
👉 Telegram link for algorithmic tutorial: t.me/javaaid
👉 Telegram link for hackerrank solutions: t.me/hackerran...
✅ Recommended playlists ►
👉 All hackerrank solutions: • How To Master In Data ...
👉 New To JAVAAID ? Watch These Videos: • Prefix Sum Algorithm |...
👉 Algorithms Fundamental: • Algorithms Fundamental
👉 Coding Interview Questions: • Coding Interview Quest...
👉 Dynamic Programming Tutorial For Beginner: • Dynamic Programming Te...
👋 Let’s Connect ►
Git Hub: github.com/kan...
Twitter: / kanahaiyagupta
Linked in: / kanahaiya-gupta
Facebook: / coolkanahaiya
Instagram: / coolkanahaiya
#JAVAAID #HackerRankSolutions #HackerRankTutorials #implementation #prefixsum #HackerRank #JavaAidTutorials #Programming #DataStructures #algorithms #coding #competitiveprogramming #JavaAidTutorials #Java #codinginterview #problemsolving #KanahaiyaGupta #hackerrankchallenges
Hello Coding Lover,
If you have any doubts , please let me know in comments.
Damn. I did this in a codechef contest, and I didn't even know what it was :) !! Thanks for this!!
most welcome..!! 😃
I saw your video on prefix algorithm
@@sridevipatil8565 yay! Thank you!
wow really? Thats so awesome, to come up with something real by yourself on the fly
Extremely well explained. Thank You So Much, Sir.
most welcome..🙂
Liked before I even finished watching. So simply explained, slowly and well visualised, and you don't try to sound smart by complicating things. Thank you!
Thank you so much man. This algorithm is sooo smart yet so simple. Its just mind blowing. And your explanation is very good. Thank you man, you should be proud of yourself because you're helping tons of people here
you made my day
👍
Wow, just awesome man... This thing will now solve every possible problem in an array within O(n) time like Maximum Subarray sum, and all.
Range query formula will be valid when value of i>0 otherwise it gives out of array lower bound runtime error...
Thank you sir for providing such amazing lecture on prefix
sum.
nice one
Thanks for the visit
This is an awesome channel, keep the videos coming sir, we need them!
Thanks for the compliment Vivek. these kinds of comments really motivate me to do more and better.
thanks for watching and keep commenting ..:)
And these kinds of channel help us grow, thanks
thanks@@vibekdutta6539Dutta. I really appreciate it.
Nice explanation
Thanks for the clear explanation of this concept.
Excellent😃
Well explained, thanks for the video.
You are better than my Professor at my university Thanks a lot
Wow, thanks
Very useful, thank you for sharing.
I just stumbled up on your videos and this was the second video I watched after watching why Pre-fix algorithm. I really liked that you had first put up a video to say what is the difficulty the Algorithm is going to address and then explaining the alogrithm. Wonderful job, keep going.
Is there a specific order which you would recommend for us to follow though the datastructure course? Also can you please add the Hacker rank challenges which might use the specific algorithms which you explain. That would help us practice online on things you teach as well.
Appreciate your good work.
Thanks a lot @Saravanan for your detailed feedback, I really appreciate the effort you have put in just to write this feedback which generally people ignore but trust me it really motivate us to do more for you all.
I can see you have query upon the video sequence which is a valid ask but i have chosen topic randomly for my channel to see which topic people are liking or getting views because my channel is very small, so need good amount of view for growing.
we have currently 55 videos on our channel but once we add couple of more videos, will define the proper track or playlist how a person should watch the content to gain most out of it. but for now you can pick any playlist or may be start with NEW TO JAVAAID playlist.
Will are trying to add some problems on video description, so that people can go and solve it after watching the tutorial.
Thanks for the appreciation...!!
If you find our content helpful please do share among your friends.
@@JavaAidTutorials will definitely do
Thank you..!!
Many thanks sir for sharing 🙂
Best video about this topic all across internet
nicely explained
Keep watching
useful
i understood it and i enjoyed :) learning this
Thank you sir for this video.
Most welcome :)
such good explaination, thank yoouuu
very good explanation, got it in one go🔥. Thank you
Great video, you saved me tons of time!
Sir, I'm in love with your crystal clear explanation, MAZA AAGYA...GOING TO subscribe your channel now!!!!
Awesome Brother keep doing the good work
Thanks you, for your feedback 😊
very good and detailed explanation!
Watching your first video. Amazing ! Impressed of your explanation. Subscribed (Y) cheers !!
Awesome, thank you!
Simple clear and accurate explanation..
Glad it was helpful!
Amazingly explained!!
Excellent expalanation!
Thank you so much sir......very nicely explained.
nice, it's help me so much
keep doing the good work you helped me alot
Gold!
Best explanation! Thank you Bro
God bless you Sir!... Thanks for these great tutorials. Please keep doing this, we all love the way you explain us.
Thank you very much for your feedback..!!
@@JavaAidTutorials please make this channel for competetive coding using JAVA. It would be really great for us.
Yaa, i am trying my best to help people who is preparing for competitive programming.but without your support its not possible.
So please support us by sharing our Channel.
thanks for this tuto
Your explanation is very useful sir, and what a great algorithm!
very well explained thnx
Thank you so much! Now i got why A[i-1]!
Thank you, it was very helpful.
Amazing explanation!
salute to you, improved my code, thank you
Glad to hear that
This was well explained. Thank you!
This is the most brilliant example on the internet
Very clear and helpful visuals, thank you
Glad it was helpful!
Great explanation ❤
grt explanation,tq
Thank you so much sir! Slowly & clearly explained !! Keep up the good work 😊
Most welcome!
Good explanation, thanks!
thanks for making it easy sir
thanks man...never thought in such a way
Glad to know that someone learnt something new from my channel. 🙂
Keep learning , keep growing.
loved the video, Thanks Javaaid
Nice tutorial
Great explanation! You saved my life
Glad it helped!
Your videos are so good, I don't even skip the ads
I appreciate that 😀
thanks for this video, it was usefull ...
You just clear my doubts very easy , Thank you sir
😇
Such a wonderful and easy explanation! Thank youu Sir.
Fantastic Explanation! Thank you, Sir.
Nice
So clear thank you!
Nice one bro 👍
thank you..!!
Thanks brother really i like your explanation.
Thanks for the feedback 😊
This is mind blowing algorithm
i found this very useful to solve array manipulation problem by watching urs that video
Great 👍
great job! this channel is going to cross 100k this year.
Thanks a lot for your wonderful comment.
All goodies in your mouth.. 🙂
Let's see, but if you find my channel helpful, please share with others.
Wonderful video. But it would have helped, if you had given an actual problem to demonstrate this technique like you did for the two pointer technique
thanks, we have added one video link in the description which will help to understand how prefix sum algorithm can be used in actual coding problem.
🙋 Problem to solve : th-cam.com/video/hDhf04AJIRs/w-d-xo.html
@@JavaAidTutorials Thanks!
your visualization makes everything easier brother thanks for videos
Glad you like them!
Thank you for the explanation. Clear and concise!
thanks for you feedback..🙃
To the point sir, thank you so much ✌️
Most welcome!
Explained very clearly ✔
Just one word. CLEAN.
Thank you for your clean feedback..:)
Thanks a lot! Good explanation!
Glad it was helpful!
Fantastic explanation! Thank you! Very understandable
Thank you for nice feedback..
THANKS for this keep making more such videos
most welcome @Ashish.
I am trying my best ..!!
mean while, if you find it useful , please share it among your friends..!!
Thank you so much for publishing this video. It helped a lot. If you get the time then please upload more.
The significance of the algorithm is visible when you have m queries to make. Having an O(n) complexity just to calculate the sum of a range of elements is not better than using an ordinary for loop. Both have O(n) complexity. But for m queries , the ordinary for loop ha O(m*n) whereas the prefix sum has O(m + n) complexity. Better to close your video that way. Nice explanation though.
Thanks for the feedback. will keep this thing in mind while making future tutorials.
i was looking for this comment
Awesome content !!
Sir, very good explanation with pictures understood it very better.
Thank You.
Thanks a lot, @SagaRock101 for your compliment.
Super bro
thank you..:)
Thank you so much for all your videos. Your explanations are so clear and concise.
Simple and clean explanation!
Thanks a lot, Joydeep for appreciating.
Keep watching..!!
great video
Marvelous Explanation !!! Hats off
Thanks a ton 🙏
Very clear! Thank you!
thank you for the explanation!
You're welcome!
Very neat and great presentation
Thank you! Cheers!
Thanks a lot. It was very helpful.
Most welcome..😀
Thanks for posting!!
great video! my professor made this sound way more complicated than it is lol. now i need to learn how to do this applied to 2d arrays
This is really nice! Thanks for the clear explanation!
thanks mate
welcome.. 😊
Thank you
You're welcome
Well done, great work! I have been really impressed by your simple explanation :)
Thanks you very much for your feedback.😊
Love your video, very clear explanation.
Glad you enjoyed it!
The explanation was very nice.But i have a query
So to after applying this algorithm we can access the sum of any index or range of indexes in O(1) time complexity but to find the prefix sum array the complexity is still going to be O(n) so how is this really optimised?
In a situation where you have up to n queries for example, the algorithm will still be O(n) instead of O(n²) if you do the sum in normal way
This is really awesome channel.... thanks and keep up the good work !!!
Thanks, will do!