I'm a total beginner working thru cs50 and your videos have been invaluable in helping me further understand the concepts i'm being introduced to. Thanks so much for taking the time to make these.
You’re very welcome, thanks for sharing with me that these videos are helping you out on your journey. Good luck going forward as you continue to learn! :-)
The optimization allows it to exit the loop once the elements are no longer being swapped. It keeps it from always running both loops to completion, even when the sorting is finished. It makes the code a bit more complex, but safes time, especially for larger data sets. Although, out in the wild, bubble sort is not something but you will ever be using.
Thank you for the great content. Quick question - since the last element can’t be compared to the element to the right of it, wouldn’t it be more handy to start with j=1 and then compare each element to the element on the left? Is there any problem with doing so? for (int i=0; i
Hi, if selection sort, inserction sort and bubble sort have all the same time complexity, how do I choose between the three? it doesn't matter? (ofc ig in production I wouldn´t use this algorithms but I'm in college and I have to, but since all three seems equally inneficent, i would't know which one to use, maybe bubble sort because it may run less times than the other two)
Bubble sort we basically never use in practice. :-) I have heard that insertion sort is sometimes used when sorting small arrays. So for example, in some implementations of quicksort, when the portion of the array being sorted is small enough we may use insertion sort to sort the array. As to exactly why one is faster than the other... technically they are all n^2 complexity, but I think in practice we find there is performance differences with experimentation, like this article: medium.com/the-high-performance-computing-forum/performance-comparison-between-selection-insertion-and-bubble-sorts-d670d874be70.
I'm a total beginner working thru cs50 and your videos have been invaluable in helping me further understand the concepts i'm being introduced to. Thanks so much for taking the time to make these.
You’re very welcome, thanks for sharing with me that these videos are helping you out on your journey. Good luck going forward as you continue to learn! :-)
How lucky, bubble sort in C++ is exactly what I'm looking for today. 👍
Awesome, I'm glad the timing worked out! :-)
This is super helpful while studying Algorithms in a CS diploma and trying to move to that field. Thank you!
Thank you so much best C++ tutorials!
Thank you! That's the best video about Bubble Sort that I've ever seen!
You’re very welcome, I’m glad it’s your favourite bubble sort video! :-)
I was fed up with after i watched your video, i understood that ver well. Good explanation. Thank you ❤️💪🏼
Awesome, you're welcome! :-)
Thankyou Sir, this lecture really helped me out🙏
Amazing Video!! The best explanation I've seen
I'm really glad that you enjoyed the explanation! :-)
Thankes for this more than great explination, but I did not get the Optimization part! the code was easier before?
The optimization allows it to exit the loop once the elements are no longer being swapped. It keeps it from always running both loops to completion, even when the sorting is finished. It makes the code a bit more complex, but safes time, especially for larger data sets. Although, out in the wild, bubble sort is not something but you will ever be using.
Great video! Love from Bangladesh.
Well Explained, very educational
please make playlist with algorithms and data structure you're the best tutor for me
I definitely want to keep covering more algorithms and data structures. :-)
Excellent educational video! Been looking for something like this forever, but now I have found it. Thank you sir!
You're very welcome Vladimir, I'm glad you found the video and that you enjoyed it! :-)
Thank you for the great content. Quick question - since the last element can’t be compared to the element to the right of it, wouldn’t it be more handy to start with j=1 and then compare each element to the element on the left? Is there any problem with doing so?
for (int i=0; i
thank you bro
You're welcome! :-)
bro,your videos are very helpful.
but an humble request is make a playlist on data structure and algorithm .
Good idea Partho! :-) A playlist on data structures and algorithms in C++? Or a playlist on data structures and algorithms in general?
@@PortfolioCourses please only in c++. I will go to republican olympiad and it will be very helpful for me!
Hi, if selection sort, inserction sort and bubble sort have all the same time complexity, how do I choose between the three? it doesn't matter? (ofc ig in production I wouldn´t use this algorithms but I'm in college and I have to, but since all three seems equally inneficent, i would't know which one to use, maybe bubble sort because it may run less times than the other two)
Bubble sort we basically never use in practice. :-) I have heard that insertion sort is sometimes used when sorting small arrays. So for example, in some implementations of quicksort, when the portion of the array being sorted is small enough we may use insertion sort to sort the array. As to exactly why one is faster than the other... technically they are all n^2 complexity, but I think in practice we find there is performance differences with experimentation, like this article: medium.com/the-high-performance-computing-forum/performance-comparison-between-selection-insertion-and-bubble-sorts-d670d874be70.
Thank you!
You’re welcome! :-)
Can u suggest me a light ide for my low end pc BTW Excellent lecture !
I'm glad you enjoyed it! :-) Regarding an IDE, maybe Visual Studio Code with the C++ extension? code.visualstudio.com/docs/languages/cpp
@@PortfolioCourses Thanks I will try it 👍🏻
What IDE you use for C++ ?
Xcode on a Mac. :-)
Nice man
I'm glad you enjoyed it! :-)
University of Nigeria exam question
I'm writing in 2 hours 😅😅😅 ii get it