I’m glad you found the language understandable Doniyor! :-)
@logos_13 Жыл бұрын
Great Again: How to Transform a Complex Topic into Clear and Efficient Explanations. 🙏
@PortfolioCourses Жыл бұрын
I'm glad you enjoyed it! :-)
@persfallow65229 ай бұрын
I've been searching for the optimized version of the bubblesort algorithm for some days, you posted this video explaining it in a very simple and complete form. I'm glad to have found your channel, i will denitively watch all your c tutorial now, you explain better than any programming profesor i've ever had at the university. (Sorry for my bad English, english is not my native language)
@Acksakal7 ай бұрын
Pls. stop apologizing for smth that is not under your control. It's actually irritating people. I understand why you did this, English is not my first language as well, so I truly truly understand why one would say smth silly like that, but trust me you don't have to.
@OCEAN-fc9wl2 жыл бұрын
Thank you! I had a hard time understanding the code of bubble sort until I stumbled upon this video! Very well explained.
@PortfolioCourses2 жыл бұрын
I'm glad to hear it was helpful, and thank you! :-D
@dwivedys Жыл бұрын
I agree - this is a brilliant explanation!
@vaporr59292 жыл бұрын
Extremely well explained!! Came from Bro-code's channel and had to find an explanation for bubble sort. Subscribed and liked. Thank you for your guidance Kevin!
@PortfolioCourses2 жыл бұрын
You're welcome, and thank you for the kind words! 🙂 And welcome aboard!
@publicstaticvoid101011 ай бұрын
Taking a moment to thank you. I came from other videos (much more famous ones too) and they would only explain how the sorting algorithm works, but not the code. They would just write it without breaking it down. But, you did this! It's freaking amazing. I'm not even familiar with C but properly understood every single thing in this video. Awesome resource, much better than the other ones I've checked out so far.
@PortfolioCourses11 ай бұрын
Thank you for the positive feedback, I appreciate it. :-) One of my big goals is to explain what is happening "in the code" by breaking it down step-by-step, so it's really great to me that you enjoyed that.
@publicstaticvoid101011 ай бұрын
@@PortfolioCourses No problem! You're helping many people understand the underlying programming concepts. Have a great one :)
@BenvelMusic2 жыл бұрын
I'm going through the CS50X course and your C lessons are the perfect addition to fill the gaps that CS50X has. CS50 + this are perfect companions.
@PortfolioCourses2 жыл бұрын
That's excellent to hear that, thanks so much for sharing that feedback. CS50X is such an excellent resource that I'm happy someone familiar with it thinks these videos make a perfect companion. 🙂
@BenvelMusic2 жыл бұрын
@@PortfolioCourses so CS50 is really a great resource but the main complaint is that it leaves a lot of gaps for people who learn online instead of actual Harvard and there’s a huge gap between lecture , supplemental materials and labs and psets. So good job 👏 your course is extremely helpful in a way it’s broken down compared to other stuff I looked through:) I can easily make a playlist putting your stuff together with their stuff as for one comprehensive course :)
@PortfolioCourses2 жыл бұрын
@@BenvelMusic That's awesome. 🙂 I wonder if *I* should make that playlist then and share it with my viewers, "CS50: Gaps Filled" or something like that haha...
@BenvelMusic2 жыл бұрын
@@PortfolioCourses I bet you could do it better than me... But it would be a great help for students who are struggling with the assignments after watching lectures and shorts plus it's a great marketing move to get traffic ;)
@PortfolioCourses2 жыл бұрын
Haha that's why I may try to do it!
@Learn_Master Жыл бұрын
For those who haven't discovered still this channel on yt. They are missing treasure ❤
@intifadayuri2 жыл бұрын
As a software engineering student we're kinda forced to learn java (at least in my school). But I'm way more interested in C so here I am. Love your videos, you are good at teaching 😊
@PortfolioCourses2 жыл бұрын
Thank you so much for the kind words Yurika, I'm really glad to hear you love the videos. :-) I like Java... but there's something about the simplicity and purity of C that I really love.
@ryanprasad2090 Жыл бұрын
I was trying to get ChatGPT to explain the inner and outer loops to me. Your video has it beat. Thank you for making this!
@PortfolioCourses Жыл бұрын
You’re welcome! :-) And I worry sometimes ChatGPT could put me out of a job so it’s great to hear that too.
@PortfolioCourses Жыл бұрын
Thanks for the donation too by the way I just saw that now, much appreciated! :-)
@shamalpha22022 жыл бұрын
i bet no one can explain like this ........i am literally in the other world..........thanks to portfolio courses and the owner...keep posting more concepts..
@PortfolioCourses2 жыл бұрын
You're welcome, I'm glad you enjoyed the video! 🙂 You might like these C programming playlists as well: Tutorials: kzbin.info/www/bejne/qZbTfGitabqYppI Examples: kzbin.info/www/bejne/naLCi4t5qrebi5Y
@hxhchimeraantarc2268 Жыл бұрын
I was about to say isn't doing nested loop ineffective but u covered it. nice video!!
@PortfolioCourses Жыл бұрын
Thank you, I'm glad you enjoyed it! :-)
@navidradiat98762 жыл бұрын
Thanks for the tutorial, you went straight to the point which I liked very much and you explained everything clearly. I was really having problems understanding the swapping part at first until I found your video, and I'm thankful for that. Gotta say, you're pretty underrated man. I hope more people will find out your tutorials. Keep up the good work!
@PortfolioCourses2 жыл бұрын
Thank you very much for the positive feedback Navid, I really appreciate the kind words. I hope over time more people find the channel too! :-)
@fifaham Жыл бұрын
Thank you Kevin, that was very smart optimization. As a developer I like to peek into your videos to learn your tricks that are easy to implement but need an expert like you to guide us to them. You make a great mentor for developers and professionals.
@@PortfolioCourses I placed your link in the video title, if not Ok then I will remove. Please let me know.
@PortfolioCourses Жыл бұрын
That's cool, thank you for making that and sharing that Firas! :-)
@t6hp Жыл бұрын
I quickly grasped the basic bubble sort but struggled with its optimizations until I saw your video. Your clear explanation and unique syntax really helped. Thanks a lot! Could you consider making a LeetCode problem series? Your intuitive approach would be a great fit. Cheers from Egypt.
@gayanishanka97752 жыл бұрын
This is the best bubble sort explanation with everything related to it. and the optimization part was so useful. like reading a book
@PortfolioCourses2 жыл бұрын
Thank you so much Gayan for the positive feedback! :-) I'm so glad to hear you enjoyed it.
@miguelcosta4450 Жыл бұрын
I don't understand the bool swapped! When the condition is not happens because a[j] is high... Swapped will never be true and the program stop working?
@PortfolioCourses Жыл бұрын
Yes Miguel, it sounds like you've got it. When swapped is never set to true, that means we never found any out of order elements, and in that case we *want* the program to stop working because the array must be sorted. :-)
@christopheanfry Жыл бұрын
Thank you so much for tour content, doing cs50 with your clear explanations it helps a lot. Very well explained.
@PortfolioCourses Жыл бұрын
You're welcome Christopher, I'm glad the explanations have been helpful for you! :-)
@ericcheng88082 жыл бұрын
Very clear and useful! Helped me a lot, better than a lot videos on KZbin. Love the step by step explanation and you speaking speed. Hope to see more of your video coming! Again, thanks!
@PortfolioCourses2 жыл бұрын
Thank you very much Eric! We've got lots more videos to make, and a couple hundred C programming KZbin videos listed on our channel already. :-) You might like the Insertion Sort, Quicksort, Merge Sort and Selection Sort videos too!
@SarahA97 Жыл бұрын
you are amazing! you explained everything in the perfect order. i understood from the first time with zero confusions. thank you so much.
@PortfolioCourses Жыл бұрын
You're very welcome Sarah, I'm glad to hear the explanation was helpful for you! :-)
@Partridge222 жыл бұрын
very useful, i like you give an explanation for each section of code you write Thanks alot
@PortfolioCourses2 жыл бұрын
You're welcome! :-) I'm really glad to hear hat you like the way the code is explained.
@ronsalife10 ай бұрын
Your channel is saving my college degree!!
@PortfolioCourses10 ай бұрын
Aww I’m so glad it’s helping you out, and good luck with your degree, you’ve got this! :-)
@mimicmian16 күн бұрын
謝謝!
@PortfolioCourses12 күн бұрын
Thank you so much! :-)
@ripeveryday56076 ай бұрын
thank you man i have exams tomorrow and you helped me
@PortfolioCourses6 ай бұрын
You’re very welcome, and good luck on your exams! :-)
@partoffans58494 ай бұрын
dear , when you make last change on swapped , the program when get to not swapping will end the do-while loop what if after the not swapped pair there is unsorted elements right ?
@youtubeuser2352 Жыл бұрын
I am very much comfortable doing for loop so here's what I did: void bubbleSort(int *arr, int count){ int i, j, temp, counter = 0; //This is to traverse the array from left to right for(i = 0; i < count; i++){ counter++; //This is to compare the array //When you do a bubble sort, the element with the biggest value will be moved to the last index //So no need to compare until the last index when you traverse hence the counter for(j = 0; j < count-1-counter; j++){ if(arr[j] > arr[j+1]){ temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; displayArr(arr, count); } } } // displayArr(arr, count); }
@PortfolioCourses Жыл бұрын
Looks good! :-)
@youtubeuser2352 Жыл бұрын
@@PortfolioCoursescheers! I saw you have recursion and text as well as binary files. Will dig into those these coming weeks.
@PortfolioCourses Жыл бұрын
@@youtubeuser2352 Cool! 🙂
@justcurious1940 Жыл бұрын
Wait, it's wrong bro, u should put counter++ after the inner loop which is the same as using the i (variable) 🙃, sorry I tested your code just out of curiosity 🙃.
@youtubeuser2352 Жыл бұрын
@@justcurious1940Hi it's great you tested it out. It worked in my end but will test out your feedback!! I hope this YT channel starts a coding club where members can teach one another. Cheers!!
@_RahmaF2 жыл бұрын
You are the best by far and I'm not exaggerating when I say that. Thank you very much for everything, keep going 👍👍
@PortfolioCourses2 жыл бұрын
You're welcome! 🙂 And thank you very much for the kind words and encouragement!
@zahidhossainbhuiyan4882 жыл бұрын
just 10 seconds into the video and that's a great voice there ...
@PortfolioCourses2 жыл бұрын
Haha thank you Zahid! :-D
@MrDelliSanti2 жыл бұрын
Thank you very much. You made the temp variable very understandable!
@PortfolioCourses2 жыл бұрын
You're welcome Chris! :-)
@slavenpenava5413 Жыл бұрын
Second time watching this video after failing my first programing 1 exam and after taking programing course in c++ so many things are clicking for me while relearning c for my redo exam and now i finally understand why so many things are the way they are even the simple bubble sort that before confused tf out of me now looks so simple and i understand why for loops indexes and swaps are like that.
@PortfolioCourses Жыл бұрын
Awesome, I'm glad to hear your understanding of these concepts is getting better, keep going, and good luck on your redo exam Slaven! :-)
@slavenpenava5413 Жыл бұрын
@@PortfolioCoursesmanaged to get 55%, much less than I was hoping for but it's still a passing grade although it could've been more if I remembered how to do string palindrome check with recursion
@t6hp Жыл бұрын
This is a bit too advanced for someone studying programming 1, to be honest. Sorry about that man. I'm trying to change my career and do a 2-year diploma, this stuff only came up in Algorithms 1 and Data Structures 1 in my second year. Don't give up, you'll get there!
@natb0072 жыл бұрын
Danke!
@PortfolioCourses2 жыл бұрын
Wow, thank you so much Nat!!! 😀❤
@Thecurlygirly-wh3 жыл бұрын
WOW! u r amazing! Im watching this videos from Israel,you'r so clearly! thank you sooo much!
@PortfolioCourses3 жыл бұрын
You’re welcome! Glad to hear you enjoy the video! :-)
@noligrutas Жыл бұрын
Also coming from CS50x. Thanks so much for the help!
@PortfolioCourses Жыл бұрын
You’re very welcome! :-)
@muhammeddikal8551 Жыл бұрын
Thanks a lot, perfect explanation.
@PortfolioCourses Жыл бұрын
You're very welcome, I'm glad you enjoyed it! :-)
@heartfraud2 жыл бұрын
You have a great voice. Thank you for this video!
@PortfolioCourses2 жыл бұрын
Thank you for the kind feedback, and you're welcome! 🙂
@tuomasbazzan15233 жыл бұрын
thanks my dude this was very useful
@PortfolioCourses3 жыл бұрын
No problem Tuomas! :-D
@BigBoss-rh8mz2 жыл бұрын
just need some clarification...please correct me if i am wrong but i believe the outside for loop only needs to be iterated "length - 1" times. for example, if sorting in ascending order and "0" happens to be at a[9], then it will take "length - 1" or 9 iterations to get "0" to a[0]. by the way, a CS50 companion playlist would be great as others have mentioned
@PortfolioCourses2 жыл бұрын
That's true, though as shown in the video we can optimize it much more than this by stopping the loop when no swaps occur. :-) I'm actually not *super* familiar with CS50 beyond know what it is... maybe one day I can make a playlist, or if someone else can pull together a playlist of videos that pair well with CS50 that would help too.
@najdadgc022 жыл бұрын
the best explnation i could find so far! my professor said bubble sort is bad is that true or can i still use it?
@PortfolioCourses2 жыл бұрын
Bubble sort isn’t something people use in the real world because there are faster algorithms we can use instead, like Quicksort. So it’s not really “bad” so much as other better alternatives exist. :-) But it’s still very popular to learn bubble sort because it helps us learn about algorithms.
@ramimehyar4812 жыл бұрын
Excellent explanation, however, if you use (length - i) in the inner loop instead of (length - 1) you will iterate less, and save time. This way it will not iterate over the upper edge of the array again and again, since that the upper edge will be sorted quicker by simply dragging the digit down over time.
@PortfolioCourses2 жыл бұрын
Thanks Rami! In the first part of the video a completely non-optimized version is covered for explanation purposes, the optimized version is covered later in the video. :-)
@dandesgeorge6 ай бұрын
the most usefull video on this topic👑👑👑👑
@Jorge-ni9pj2 жыл бұрын
Thats a gread video, keep up the good work. Nice lessons!
@PortfolioCourses2 жыл бұрын
Thank you very much, I'm glad you liked it! :-)
@velenvskaelhas2 жыл бұрын
For the second for loop can you do "j = i+1" and then remove the "j + 1" from the if statement? or does the nested for loop have to be "j = 0"?
@PortfolioCourses2 жыл бұрын
Great question! :-) It does have to be j = 0. The problem is that each "run" of the inner loop only swaps elements that are next to each other and are unsorted. It doesn't guarantee that, for example, the first portion of X elements in the array is sorted after Y runs, or anything like that. Algorithms like insertion sort and selection sort work like that, but not bubble sort.
@velenvskaelhas2 жыл бұрын
@@PortfolioCourses ah, thanks for the info and quick reply!
@JH-ux1re2 жыл бұрын
Thank you so much! Eventually I understood what bubblesort means!
@PortfolioCourses2 жыл бұрын
You’re very welcome! I’m glad to hear you figured out bubble sort. :-D
@justcurious1940 Жыл бұрын
Thank u Kevin, great video this is the same code but using for loop and break statement instead of do while loop, I'm not sure if they are the same when it comes to performance : int array[] = {4,1,-6,9,5,66,-99,0,6358,-58624}; int length = 10; bool flag = true; for(int i = 0 ; i < length ; i++){ for(int j = 0 ; j < (length-1-i) ; j++){ if(array[j]>array[j+1]){ int temp = array[j]; array[j] = array[j+1]; array[j+1] = temp; flag = false; } } if(flag) break; } for(int i = 0 ; i < length ; i++){ printf("%d\t",array[i]); }
@PortfolioCourses Жыл бұрын
That looks good to me! :-)
@nub8312 Жыл бұрын
Great tutorial but what if in 10:08 we use i < (length - 1) instead of i < length
@PortfolioCourses Жыл бұрын
That will work too. :-) The best way that we want to optimize the outer loop is covered towards the end of the video. Using length -1 will save us one iteration of the inner loop, but checking if a swap occurred can save us many, many more for large lists.
@nub8312 Жыл бұрын
Yea, that was is much better. Thanks :)
@nub8312 Жыл бұрын
@@PortfolioCourses oh and btw did you also make a video about the "max_repeating_element" in an array. Like in this int numbers[] = {1, 2, 3, 2, 1, 3, 1, 2, 3, 1}; the Maximum Repeating Element is 1
@PortfolioCourses Жыл бұрын
Yes I have a video on that topic here: kzbin.info/www/bejne/jJ_Wnpp-er-cgqM. :-)
@abhivish20172 жыл бұрын
Wow.. well explained.. thankyou so much..
@PortfolioCourses2 жыл бұрын
You're very welcome Abhi! :-)
@xanaxityАй бұрын
do-while is a bit overkill, but im studying for exam so I'll cut that part out if question came. Nice video nonetheless.
@freelance-writer5 ай бұрын
great explanation!
@majidelmardouli7174 Жыл бұрын
Clear and simple thanks a million
@PortfolioCourses Жыл бұрын
You’re welcome Majid, I’m glad you enjoyed it! :-)
@mrdarbab11 ай бұрын
we learned this on the c64 in school. and the divide and conquer.
@baboucarrgibba93362 жыл бұрын
thank you so much, the explanation was perfect .
@PortfolioCourses2 жыл бұрын
You’re welcome Baboucarr! :-) And thank you for the kind feedback.
@kanho.e4 ай бұрын
Thanks you explained it well
@adamsetterberg52233 жыл бұрын
First thing Great video!
@PortfolioCourses3 жыл бұрын
Yes, we have a video on filling an array with random numbers here: kzbin.info/www/bejne/a4CpfZyqZr-ZY7M. You could use this technique to sort random numbers. You may find this video interesting too: kzbin.info/www/bejne/aZvRo5WqpLyaetE.
@iceplayer37228 ай бұрын
Iwant to know how to sort numbers in lottery, because its big problem for me.
@DoxaPacheci-mk4hjАй бұрын
using something matematicions call pseudoramdom u create a seed with a random binary number and multiply the number sorted by the pseudonimber that will generate random number
@dilhyderstudios85692 жыл бұрын
Tq so much❤️ it is easy to understand
@PortfolioCourses2 жыл бұрын
You're very welcome! :-D
@aizen11012 жыл бұрын
wow. this video is just great!
@PortfolioCourses2 жыл бұрын
I'm glad you enjoyed the video! 🙂
@mr.fantastic3827 Жыл бұрын
Why is it i < length and not i
@PortfolioCourses Жыл бұрын
Great question! It’s because arrays are zero indexed in C. So if we have an array of length 3 the indexes for the array are 0, 1 and 2. So if we kept the loop going until i equals length, we would be using the index 3, which is one past the end of the array. :-)
@drago-ig6ms Жыл бұрын
the best in the net!!!
@PortfolioCourses Жыл бұрын
Thank you very much for the positive feedback, I’m glad you enjoyed the video! :-)
@dostseferoglu68533 жыл бұрын
what a nice tutor,al
@PortfolioCourses3 жыл бұрын
Thank you!
@robf55502 жыл бұрын
This is soo good thank u!!
@PortfolioCourses2 жыл бұрын
You’re welcome Rob! :-)
@tarikahmad47492 жыл бұрын
you are so so good brother
@PortfolioCourses2 жыл бұрын
Thank you for the support Tarik! :-)
@NikitaSafronov-y6i2 жыл бұрын
The best! As usual
@PortfolioCourses2 жыл бұрын
Thank you… as usual! :-)
@NikitaSafronov-y6i2 жыл бұрын
@@PortfolioCourses Sir, are you a Professor/Teacher at some Uni or College? Maybe used to be. =)
@PortfolioCourses2 жыл бұрын
@@NikitaSafronov-y6i Yes, I teach at both a College and University in Canada. :-)
@ardeltiocojefflauron88822 жыл бұрын
Thank you so much you saved me
@PortfolioCourses2 жыл бұрын
You're very welcome Ardel, I'm glad to hear the video helped you out! :-)
@mayankbadodiya5353 Жыл бұрын
thank you so much sir
@PortfolioCourses Жыл бұрын
You're welcome Mayank! :-)
@natb0072 жыл бұрын
Thank you so much!
@PortfolioCourses2 жыл бұрын
You're welcome! 😀
@kaltube48173 жыл бұрын
well done
@dexdox_startups Жыл бұрын
i cant thank you enough !!!!!!
@PortfolioCourses Жыл бұрын
You’re very welcome Muhammad! :-)
@quanloithanh39342 жыл бұрын
😍😍😍
@PortfolioCourses2 жыл бұрын
I'm glad you enjoyed it Quan! 😀
@خالدالناشري-د5ز3 жыл бұрын
Goood job Keep going on
@PortfolioCourses3 жыл бұрын
Thank you! 😀
@Ryokans2 жыл бұрын
LOVE YOU!!
@PortfolioCourses2 жыл бұрын
Thank you Ricky! :-)
@marbles55902 жыл бұрын
Your lessons are nice, but I'm still having a hard time absorbing such things.
@PortfolioCourses2 жыл бұрын
Algorithms like bubble sort are a level up in difficulty from learning the language basics, so I would say it’s normal for it to be hard to absorb them. :-)
@odys15162 жыл бұрын
its incorrect in c language
@PortfolioCourses2 жыл бұрын
What is incorrect? The code is posted here, it should work: github.com/portfoliocourses/c-example-code/blob/main/bubble_sort.c
@stpdaz8 ай бұрын
Shout-out boss
@PortfolioCourses8 ай бұрын
Thank you! :-)
@edward31052 жыл бұрын
Man this look hard,why my Iq is so low? Why I can't change that? :(
@PortfolioCourses2 жыл бұрын
Coding is tough for most people, and for a long time too unfortunately. If you keep at it, it can start to get easier though. :-) Sometimes the trick is to make sure you know all the required background concepts first. So before trying to learn bubble sort, I would try to learn about loops, if-statements, variables, etc, first. Maybe try starting off with this course for beginners first: kzbin.info/www/bejne/qaStimiDebGdotE. :-)
@edward31052 жыл бұрын
@@PortfolioCourses I understand the if,while,for statements but it's hard for me to solve problems since I don't have any ideas how to solve it.I measured my IQ it's 125,should I try to continue?I graduated Computer Science but mostly I copied to exams and now I am trying to learn embedded systems.Should I just watch tutorials or should I start writing code?
@PortfolioCourses2 жыл бұрын
@@edward3105 I wouldn't worry about your IQ either way. :-) It's less about "IQ" and more about "learning how to learn". Learning how to solve programming problems is less about IQ and more about having a large amount of experience seeing how different problems are solved... once you understand how to solve many problems, it gets easier to understand further problems. But it takes a long, long time, and it's definitely not easy. But if you keep at it, it will get better. I would recommend both watching tutorials AND trying to write code. Maybe for each topic you wish to learn watch a tutorial, and then try to write code.