No idea if u are still checking these but it can be done like this too, a bit simpler way: for (int i = 0; i < 20; i++) { for (int d = i; d < 20; d++) { if (arr[d] < arr[i]) { swap(arr[i], arr[d]); } } }
@daneerosa5996
8 жыл бұрын
Thanks for the tip, going through sorting now!
@ravindrabanchhod1579
7 жыл бұрын
Wow, that's very helpful, thanks a lot!
@illustrio8688
6 жыл бұрын
Thats Bubbles sort
@abdullahbuttar5791
4 жыл бұрын
ahhhhhhh ! thanku so much , i dont know how to thank you.....
@alexisrodriguez7127
3 жыл бұрын
This is NOT selection sort!! this is bubble sort. which is less optimized that selection sort
@andya4795
7 жыл бұрын
This was a great simple explanation - you should be teaching my programming class ... our prof is pretty tough to understand and his use of conventions is terrible (no brackets around for loops or if/else statements?!?!). Funny too - this video was posted on my birthday, and the very day I decided to start exploring schooling for programming.
@MonkeyBarsEveryday
7 жыл бұрын
I wish this guy was my professor, too. My current professor never actually writes code and talks through it. He just uses examples. It's much easier to follow when written and explained simultaneously.
@SmartProgramming
6 жыл бұрын
nice one sir, thank you 👍
@Chuletita681
3 жыл бұрын
Thank you so much... You made it so easy to understand
@MonkeyBarsEveryday
7 жыл бұрын
Excellent explanation!!!
@bobdurk5180
9 жыл бұрын
Excellent , this is the way I like to learn !
@mohamedhussin6712
8 жыл бұрын
awsom very fantastic lessons i hope you illustrate bubble and insertion sort and the rest types really i l love your way in illustration
@JohnWickXD
3 жыл бұрын
Thanks man...Now I understand it
@adeebalaifan8684
2 жыл бұрын
Why the swap at line 30 ?
@muhammadahmadtariq5715
6 жыл бұрын
not working on visual c++ 6.0
@andybabay9879
6 жыл бұрын
How do i do this with strings? i understand how to do this with numbers, but not strings.
@278haris
5 жыл бұрын
tried changing int to char?
@seadury9981
2 жыл бұрын
what about C, it doesn't have the swap function
@SonnyLando
7 жыл бұрын
How could you do this using strings and string arrays
@andya4795
7 жыл бұрын
If you wanted them placed in UTF-8 value order, you'd develop another nested loop to compare individual letters of each string prior to making the swap.
@saadatfaiz6376
8 жыл бұрын
swap isn't working on visual studios 2013 :(
@rajatsrivastava4291
8 жыл бұрын
What IDE do you use ?
@FrankLopezx
9 жыл бұрын
everything makes more sense when you bring in the swap function
@andya4795
7 жыл бұрын
Agreed - our prof tried to give us some convoluted XOR swap function he made that isn't intuitive at all. I'm not sure what technique the swap function in the built in library is using though.
@manasaparupati5225
7 жыл бұрын
{3,7,4,2,1,6}ur code is not working for this input array.please reply me
Пікірлер: 32