Hey man. Been watching your videos for a few weeks. Your explanations and thought process is exactly what I needed to get a refresher on all things ds&a. I just recently landed a job offer at a dream company, so thanks a ton for all your hard work and help!
Table of Contents: Talking About Stuff 0:00 - 1:05 Introducing Quicksort 1:05 - 2:04 The Split Subroutine 2:04 - 2:43 The Partition Subroutine 2:43 - 3:24 Partitioning: Choosing A Bad Pivot 3:24 - 10:34 Partitioning: Choosing A Good Pivot 10:34 - 15:11 Analysis: Choosing Bad Pivots 15:11 - 19:06 Analysis: Choosing Good Pivots 19:06 - 22:07 Analysis: Good Pivots - Work Done At Leaf Level 22:07 - 23:37 Flashback To Merge Sort 23:37 - 24:01 Why Quicksort Is O(n*log(n)) 24:01 - 25:02 Wrap Up 25:02 - 26:12 Errors: 3:25 - 15:11 -> I messed up how I advanced 'i' in both examples. I should have started 'i' at left - 1 everytime...my bad. What should happen is that we should start 'i' at 'left - 1' and anytime we swap into 'i' we always advance 'i' FIRST before the swap. These errors don't change the fundamental job of 'i', which is to keep the tail of the section of items less than the pivot. Make sure you take that away from this. 4:02 -> Forgot to edit that text out haha 24:23 -> This is only the exact bound on the best case. Not the average case as well. The code for quicksort is in the description. Fully commented for teaching purposes.
2022 and you're still helping people. I'm not enjoying my classes but watching your videos give me reassurance that I really like these topics. Thanks a lot man!
FINALLY someone who explains what a pivot is. Pivot concept is key to understand how quicksort works and also to understand "the kth largest element in an array" problem.
One of the best Tech -tuber, has an website on interview prep and still gives his best in youtube explanantions and dont advertise his website on youtube like tech lead , clement does, tech-lead and clement should learn from him on how to give best in youtube and stop honeytrapping vulnerable kids
dude you're literally the only reason why I understand these algorithms. My CS 101 prof teaches so weirdly, you should really consider pursuing academia if you haven't already
It's impacting. In a good way. Most professors in most cs programs really don't go into detail about these algorithms much. Even grad school programs have that problem at times because then it seems like you should know these things. You're doing a good job and hopefully this channel and others stick around.
Don't stop doing what you're doing! These videos have been an incredible help in getting my head around algorithmic time complexity for my computer science masters - thank you!!
Stumbled upon this during my interm. algorithms class at UC Riverside. Honestly dude, your short videos do more than entire lectures for my understanding. Thank you.
Dude. Thank you for putting the time in making these videos. They are IMMENSELY helpful! Don't burn out making them, take your time, do them at your pace, cause they are some of the best in the business. Really, you are awesome.
Thanks. I haven't burnt out. I just started work in San Francisco and I am building a pretty cool and fancy site for this channel which I hope to launch mid-end of July. Once it is out I'll be back on the throttle to post more technical videos as I support the site and begin working on the next software.
This is one of the Back to Back SWE videos have helped me understand "Introductions to Algorithms" - a book probably aimed at people who already understand the algorithms in question. I am so glad for this series. Thanks a lot!
you have been a huge factor in helping me understand some of these concepts. Please keep it up. You're the first place that I go when I'm having trouble.Thank you!
Because you asked to. I'm posting again to let you know that you're helping me so much. Thank you for your help. The impact is huge on my life. These resources are some of the best most helpful videos on interviewing I've seen.
You are my favorite! What is really helpful is that you explain the idea, which is what a lot of videos don't do. Mosts just focus on the coding, but not in the concepts. I'm very thankful I found you!
Hey, my friend. I'm an SDE with a couple of years of industry and academic background. I really appreciate your effort to explain this algorithm. Regardless of the commercial purpose behind the video, your explanation is mostly accurate and easy to understand ( Though I have to say, it's better for you to put the average case before the worst-case example in this video.) Carry on, looking forward to new content from you! btw: I have the confidence to say many, yes many, explanations of quicksort from some others are WRONG. Well done, sir!
Hey man thanks for posting these videos they are helping me a bunch, I'm about a month out from my job hunt, using your videos to prep while I continue to learn some Angular. Going to pitch in what I can for the Patreon thanks again !!!
Thank you for making these videos! The way you explain and break down things are great! They are helping me so much here in 2022 and I am going to try and watch all of them. I wish you much success in your career!
Hay man I just want to say thanks for all the videos because of that today I am having f2f interview in Amsterdam. I am not sure I will pass or not but you gave me enough confidence to face it.. :) cheers
Hahaha nice! I just came back from Amsterdam...like 2 days ago. That's wild. I walked past the Oracle office behind this one Dutch dude who was speaking Dutch and he had a cool Oracle bookbag. Ahhh...good times.
I have never commented on a UA-cam video before but thank you so much for this! Your code for Quicksort actually makes sense, which is something I have not found to be the case for other sources, including Cracking the Coding Interview. I have subscribed :)
At 10:38, you say that it doesn't matter where i starts; as far as I saw the algorithm says it's got to start at start - 1, which de facto makes all the passes in the first iteration to swap i with j, but all instances of i and j are equal (that's cause you increment the i before the swap), or the condition about array[j]
Happy Holidays 🎉 this means so much, thanks, songulmesale! We'd love to offer you a 40% Off our exclusive lifetime membership just use the code CHEER40 - backtobackswe.com/checkout?plan=lifetime-legacy&discount_code=CHEER40
The example at 11:00 can be more helpful if it has a number in the first half that is greater than the pivot, for example [3, 8, 4, 5, 9, 7] and pivot is 7. when i = 0, j = 1, we don't do the swap since 8>7, then j becomes 2 and based on your description we swap 3 and 4? What about 8 in between them? It should not stay where it is
2021 and your explanations still helps, a lot. thank you so much! gonna binge on your vids and hopefully it helps my journey throughout this CS major :')
Sir, I really need a help from you, I am not really good at Dynamic programming and there's a problem that's eating my head for a long time, could you please please please solve it and make me understand?
There an explanation of the problem by Rachit Jain on UA-cam but I didn't get the multiple DP going on in parallel. Please help me, coz there's none to guide me! Thanks! :)
Amazing videos, the only teacher who actually explains algorithms clearly! One question- at 11:19 you said that "it does matter where i goes... I messed up... but you get the idea". Where should i go, at -1 or 0?
I saw in your attached code that i starts at -1, so that when j finds a number, i will be incremented to point to the next available spot in the 'less-than' portion. Then the swap occurs, and j is advanced forward. However, I've also been messing around with my own implementation and it seems that you can start i at 0, as long as you perform the swap first and THEN increment i. When it comes to reinserting the pivot, it needs to be at i (rather than at i+1 when i starts at -1).
Love the video, but isn't there a more optimized way to implement quick sort? In the code, it always picks the last item as the pivot, which is some cases with large inputs, it will timeout.
Happy Holidays 🎉 Haha Thank you for your kind words! We'd love to offer you a 40% Off our exclusive lifetime membership just use the code CHEER40 - backtobackswe.com/checkout?plan=lifetime-legacy&discount_code=CHEER40
Thanks for the nice video! I think the most difficult part of this algorithm is the "index", however, it's ommitted. May I know where is the demo code? If the case "a[j] is less than pivot, but j-i is bigger inclusively than 2" is added, then it will be more clear. By the way, how to handle this situation? Maybe the definition of i should be the "the position of the pivot", instead of "the last element which is smaller than pivot".
A CS tutor that speaks clearly and concisely??? Very rare!
yeah
Jonathan Banuelos you mean he doesn’t speak Indian accent lol
@@alanliang9538 what do you mean by that??
@@pulkitjain8135 racism
just say you're xenophobic and move on
Hey man. Been watching your videos for a few weeks. Your explanations and thought process is exactly what I needed to get a refresher on all things ds&a. I just recently landed a job offer at a dream company, so thanks a ton for all your hard work and help!
nice. Hope work goes well and you are happy :)
My feeling is also same here, Iwas searching for this kind of thinking ability
This guy's : is this ever impacting u?
Me : what? It's saving my life
great lol
Table of Contents:
Talking About Stuff 0:00 - 1:05
Introducing Quicksort 1:05 - 2:04
The Split Subroutine 2:04 - 2:43
The Partition Subroutine 2:43 - 3:24
Partitioning: Choosing A Bad Pivot 3:24 - 10:34
Partitioning: Choosing A Good Pivot 10:34 - 15:11
Analysis: Choosing Bad Pivots 15:11 - 19:06
Analysis: Choosing Good Pivots 19:06 - 22:07
Analysis: Good Pivots - Work Done At Leaf Level 22:07 - 23:37
Flashback To Merge Sort 23:37 - 24:01
Why Quicksort Is O(n*log(n)) 24:01 - 25:02
Wrap Up 25:02 - 26:12
Errors:
3:25 - 15:11 -> I messed up how I advanced 'i' in both examples. I should have started 'i' at left - 1 everytime...my bad. What should happen is that we should start 'i' at 'left - 1' and anytime we swap into 'i' we always advance 'i' FIRST before the swap. These errors don't change the fundamental job of 'i', which is to keep the tail of the section of items less than the pivot. Make sure you take that away from this.
4:02 -> Forgot to edit that text out haha
24:23 -> This is only the exact bound on the best case. Not the average case as well.
The code for quicksort is in the description. Fully commented for teaching purposes.
now we are at 161k
thank you for all your efforts
love from india
2022 and you're still helping people. I'm not enjoying my classes but watching your videos give me reassurance that I really like these topics. Thanks a lot man!
Glad to hear that! Subscribe to our DSA course with a flat 30% discount for some amazing content b2bswe.co/3HhvIlV
FINALLY someone who explains what a pivot is. Pivot concept is key to understand how quicksort works and also to understand "the kth largest element in an array" problem.
yes
I wish I just watched your videos instead of taking my algorithms and data structures class
ye
One of the best Tech -tuber, has an website on interview prep and still gives his best in youtube explanantions and dont advertise his website on youtube like tech lead , clement does,
tech-lead and clement should learn from him on how to give best in youtube and stop honeytrapping vulnerable kids
thx
tech lead is a psychopath lol
dude you're literally the only reason why I understand these algorithms. My CS 101 prof teaches so weirdly, you should really consider pursuing academia if you haven't already
thanks and I do not want to
@@BackToBackSWE relatable LOL
@@BackToBackSWE lmao
It's impacting. In a good way. Most professors in most cs programs really don't go into detail about these algorithms much. Even grad school programs have that problem at times because then it seems like you should know these things. You're doing a good job and hopefully this channel and others stick around.
Don't stop doing what you're doing! These videos have been an incredible help in getting my head around algorithmic time complexity for my computer science masters - thank you!!
You're one of the most eloquent tech guys on youtube. I just started programming this month, and your video helped me implement quicksort in JS!
great! but im not a tech guy, Im just a guy
Stumbled upon this during my interm. algorithms class at UC Riverside. Honestly dude, your short videos do more than entire lectures for my understanding. Thank you.
One of the best instructors on UA-cam! Thank you for your contribution!
Dude. Thank you for putting the time in making these videos. They are IMMENSELY helpful! Don't burn out making them, take your time, do them at your pace, cause they are some of the best in the business. Really, you are awesome.
Thanks. I haven't burnt out. I just started work in San Francisco and I am building a pretty cool and fancy site for this channel which I hope to launch mid-end of July. Once it is out I'll be back on the throttle to post more technical videos as I support the site and begin working on the next software.
This is one of the Back to Back SWE videos have helped me understand "Introductions to Algorithms" - a book probably aimed at people who already understand the algorithms in question. I am so glad for this series. Thanks a lot!
great
This guy is a genius, find an easy and intuitive way to explain.
Impact ?? it's life saver.... when ever i get stuck on some basic concepts ..this is the place i jump to... keep up the good work.
hahaha thanks, yeah I'm back, about to make a ton of videos
you have been a huge factor in helping me understand some of these concepts. Please keep it up. You're the first place that I go when I'm having trouble.Thank you!
Thank you, glad you liked it 😀
Do check out backtobackswe.com/platform/content
and please recommend us to your family and friends 😀
Because you asked to. I'm posting again to let you know that you're helping me so much. Thank you for your help. The impact is huge on my life. These resources are some of the best most helpful videos on interviewing I've seen.
When did I ask lol
@@BackToBackSWE 0:44 lol
"We do not place an item, into the section, that is less than the pivot." - just needed that much.
Thank You, Brother! #keepUptheGoodWork.
Hey Bro.... Just wanna say... Keep up with your videos, they help students like us all around the globe..... ❤️❤️❤️❤️❤️❤️
hah nice!, wassup
You are my favorite! What is really helpful is that you explain the idea, which is what a lot of videos don't do. Mosts just focus on the coding, but not in the concepts. I'm very thankful I found you!
great and glad you're here.
this channel deserves more than million subs
Hey, my friend. I'm an SDE with a couple of years of industry and academic background. I really appreciate your effort to explain this algorithm. Regardless of the commercial purpose behind the video, your explanation is mostly accurate and easy to understand ( Though I have to say, it's better for you to put the average case before the worst-case example in this video.) Carry on, looking forward to new content from you!
btw: I have the confidence to say many, yes many, explanations of quicksort from some others are WRONG. Well done, sir!
one more suggestion, I will be better for you to explain why quick sort is "Quick". I know the answer..but..I'll leave the work to you...
Hey man thanks for posting these videos they are helping me a bunch, I'm about a month out from my job hunt, using your videos to prep while I continue to learn some Angular. Going to pitch in what I can for the Patreon thanks again !!!
Aw, thanks
Hey Man i am also in the same position with Algo and Angular but i think i am comfortable with Angular, Do you want to study together ?
I've never understood something so clear... thank you so much! :')
nice!
This is the only vedio I found which tells exactly what exactly is PIVOT.. THANKS
BRO
sure...bro.
probably the most easy to understand video on quicksort. Thank you
Thank you for making these videos! The way you explain and break down things are great! They are helping me so much here in 2022 and I am going to try and watch all of them. I wish you much success in your career!
Thank You!!
Do check out backtobackswe.com/platform/content
and please recommend us to your family and friends :)
I guess you have not enough subscribers and watches! One of the best CS videos I ever seen. Thank you!
we coolin', in time
I hope you realize that you are changing peoples lives!(for the better).
great to hear
Watching from Chicago and love this so much! Thanks for clarifying this algorithm.
I haven't understood quicksort for 2 years, thanks a bunch man
thanks for watching
For sure your videos is causing a positive impact. At least, for me this channel is so valuable. Great job man!
Thank you so much,you probably dont know how much this means to me. Love from india🇮🇳
sure and thanks
I wish i could like the video million times. Thanks for the gift.
sure
why is this guy better than the lecturer in my course that I paid $2.2k for?
im not sure
give this man a gold metal! respect!
thanks
Hay man I just want to say thanks for all the videos because of that today I am having f2f interview in Amsterdam. I am not sure I will pass or not but you gave me enough confidence to face it.. :) cheers
Hahaha nice! I just came back from Amsterdam...like 2 days ago. That's wild. I walked past the Oracle office behind this one Dutch dude who was speaking Dutch and he had a cool Oracle bookbag.
Ahhh...good times.
@@BackToBackSWE Ohh I missed my chance of doing mock interview with you :p
@@jageenshukla4825 haha
You're very good at explaining. I watch your videos and they make me very happy
Amazing Videos ! I love how you explain everything at the deepest level which is exactly what I need to understand those algorithms properly :D
great
Wonderful tutor! With each passing days, I am falling in love with Algo's, good job brother..looking forward to have more lessons from u.
great to hear.
What a great teacher, my god! always amazed by your skills ❤
TY so much. Clearest quicksort video on youtube
thanks
This channel made me love algorithms again
ye
Teaching is an art and you are an artist :)
yis
Thanks for hard work, I can see how much effort you put in this video.
ye
Best content I have ever encountered
thx
@@BackToBackSWE you really read your comments. Only some have this quality.
Really Impressed
@@saurabhjindal2775 Yeah haha, why wouldn't I. I really care about what I'm building.
I have never commented on a UA-cam video before but thank you so much for this! Your code for Quicksort actually makes sense, which is something I have not found to be the case for other sources, including Cracking the Coding Interview. I have subscribed :)
welcome to the rodeo
You are a legend. I always go watch you on here before a class :)
At 10:38, you say that it doesn't matter where i starts; as far as I saw the algorithm says it's got to start at start - 1, which de facto makes all the passes in the first iteration to swap i with j, but all instances of i and j are equal (that's cause you increment the i before the swap), or the condition about array[j]
ok
It's glad to see that my favorite basketball player Chris Paul teaching the algorithm courses.
ı hated data structures lectures before thıs man but now I can easily understand everythıng .thank u a lot .You are my hero :)
Happy Holidays 🎉 this means so much, thanks, songulmesale! We'd love to offer you a 40% Off our exclusive lifetime membership just use the code CHEER40 - backtobackswe.com/checkout?plan=lifetime-legacy&discount_code=CHEER40
Finally understand quick sort! Thanks so much
You had a great impact on me!!! You are a blessing!!!!
nice, wassup
Your videos are really awesome and have helped me alot in my data structures class for LSU. Thank You!
sure
It is really much helpful and good then our professor lectures
thx
Perfect! I really love that, you explain it as good as it's posssible. Nice.
You helped me survive an algo class 💯
Thanks for this, I was actually wondering couple days ago why there isn't a sorting video for quick sort.
yeah, give me a year or 2, this channel needs to be fleshed out more. I'm aware of all that's missing for the most part.
The example at 11:00 can be more helpful if it has a number in the first half that is greater than the pivot, for example [3, 8, 4, 5, 9, 7] and pivot is 7. when i = 0, j = 1, we don't do the swap since 8>7, then j becomes 2 and based on your description we swap 3 and 4? What about 8 in between them? It should not stay where it is
ok
the 8 is going to get pushed back
You are gifted! Thanks for making these concepts easy
2021 and your explanations still helps, a lot. thank you so much! gonna binge on your vids and hopefully it helps my journey throughout this CS major :')
Continue! You are doing great, man! Thanks a lot!
The best explanation ever, so detailed, I really enjoyed it!
nice
Sir, I really need a help from you, I am not really good at Dynamic programming and there's a problem that's eating my head for a long time, could you please please please solve it and make me understand?
The problem is "Faffa and The Ancient Mathematician" from Code forces.
There an explanation of the problem by Rachit Jain on UA-cam but I didn't get the multiple DP going on in parallel. Please help me, coz there's none to guide me! Thanks! :)
@@vibekdutta6539 haha um, I'm pretty busy, I'd love to but don't think I can make the time today
Amazing videos, the only teacher who actually explains algorithms clearly! One question- at 11:19 you said that "it does matter where i goes... I messed up... but you get the idea". Where should i go, at -1 or 0?
I saw in your attached code that i starts at -1, so that when j finds a number, i will be incremented to point to the next available spot in the 'less-than' portion. Then the swap occurs, and j is advanced forward. However, I've also been messing around with my own implementation and it seems that you can start i at 0, as long as you perform the swap first and THEN increment i. When it comes to reinserting the pivot, it needs to be at i (rather than at i+1 when i starts at -1).
YOU ARE HAVING AN IMMENSE IMPACT. AND THANKS FOR IT!!!
thanks haha
You explanation is amazing. be assured that one day I will take few days off to watch all your algorithm themed videos :)
thanks and nice
This is so well presented. Instant subscribe. Thanks man.
Yet another great video. Where were you when I was learning this stuff in undergrad? :-)
In middle school I think...near corn fields 🌽🌽
If i could like this 100 times i would 😩omg best video on youtube about quicksort! I literally have watched all lol thank you for making these videos
ye
great video. Could you please make a video for Subset Sum Problem (Print all subsets with given sum) Dynamic Programming?
maybe
the best teaching technique
Hello, where did you go? Why you are not uploading new videos? You are a great teacher
Love the video, but isn't there a more optimized way to implement quick sort? In the code, it always picks the last item as the pivot, which is some cases with large inputs, it will timeout.
U just saved my next exam
What I learned.
1. Find a home for 1
2. Sandwich 1
3. Resting place for 1
man I love your videos, your teaching skills are amazing!
Very intuitive explanation! thanks...
so how do we choose an optimal pivot element, so our quicksort operates in best/average-case time complexity. ?
Thank you so much! You're a genius in your explanation way
I like your videos even before starting .. that's how much I like your content..keep making this kind of videos pls :)
ok
tbh miss you speaking passionately loud ahah it got me PUMPED TO LEARN but thank u always for these
hahahaha, I HATED that era of this channel. I wish I could erase it but the content is still decent. So I left it.
best explanation on quick sort !!
thanks
Congrats for 10k!
Thank you *smile*
Really thanks for the detailed explanation, this video solved my questions watching Wiki of Quicksort
Happy Holidays 🎉 Haha Thank you for your kind words! We'd love to offer you a 40% Off our exclusive lifetime membership just use the code CHEER40 - backtobackswe.com/checkout?plan=lifetime-legacy&discount_code=CHEER40
Subscribed! Very good explanations, please continue doing what you do.
thx
Dude, you're gifted! Thanks so much for helping us to get our dream jobs :D
sure
Every other video I have seen so far avoids the worst case. Quicksort is relatively easy except for when you have a 1 or a max val.
6:10
"what does i do?" - me trying to learn DS&A before @Back To Back SWE
The more sorting videos I watch, the more unsorted my brain becomes.
I love your videos! Keep up the good work!
You're so cool ! Thank you for your videos, now I'm more confident about passing my exam :)
nah ur cool
Hey bro, can you do an average case analysis for quick sort with mathematical induction.
I cannot but would if I had the time allocation and if it was rewarding enough from an angle of benefiting the whole viewerbase , etc.
Any new videos? Your explanation is so good!
I really felt the "move on" at 7:37.
Btw, really helpful video!
Thanks for the nice video!
I think the most difficult part of this algorithm is the "index", however, it's ommitted.
May I know where is the demo code?
If the case "a[j] is less than pivot, but j-i is bigger inclusively than 2" is added, then it will be more clear.
By the way, how to handle this situation?
Maybe the definition of i should be the "the position of the pivot", instead of "the last element which is smaller than pivot".
The repository is deprecated - we only maintain backtobackswe.com.
You are a real man
im normal
Thanks man,good explanation.
sure