8.3.1 Sorting in Arrays | Selection Sort | C++ Placement Course

  Рет қаралды 1,120,682

Apna College

Apna College

Күн бұрын

Notes of this video: drive.google.c...
Apni Kaksha Instagram: / apnikaksha
Apni Kaksha Telegram: t.me/apnikaksh...

Пікірлер: 1 100
@dippelarc8997
@dippelarc8997 3 жыл бұрын
✤People will throw stones at you. Don't throw them back. Collect them all and build and empire.✤ Thank You A.D.
@chiranjeev331
@chiranjeev331 3 жыл бұрын
kzbin.info/www/bejne/sKO4nImln6h5Zs0
@sauravrawat5587
@sauravrawat5587 3 жыл бұрын
😂😂
@shrutidas359
@shrutidas359 3 жыл бұрын
why people will throw stones at her🤔🤔🤔
@ashutoshharma
@ashutoshharma 3 жыл бұрын
they had us in the first half
@starkendeavours7072
@starkendeavours7072 3 жыл бұрын
Lovely...dil khush ho gya ye sunke❤️❤️❤️
@nikhillodhi7427
@nikhillodhi7427 3 жыл бұрын
Will watch all these videos after my board examinations... Now came here to give a like for there hardwork👍👍
@chiranjeev331
@chiranjeev331 3 жыл бұрын
Me to. From which board are you
@chiranjeev331
@chiranjeev331 3 жыл бұрын
I am from cbse board
@Pratyush_Srivastava24
@Pratyush_Srivastava24 3 жыл бұрын
CBSE , same here
@soniabhatia9853
@soniabhatia9853 3 жыл бұрын
Same
@krishjani9629
@krishjani9629 3 жыл бұрын
Same here.... From Gujarat boards
@rounakghosh469
@rounakghosh469 3 жыл бұрын
Waiting for the day when educational videos will start trending in KZbin ❤️
@AbhishekKumar-nz9dn
@AbhishekKumar-nz9dn 2 жыл бұрын
india me chapri bohot bhare hue hai ,jinka education se koi lena dena nhi hai .
@hatcoder
@hatcoder Жыл бұрын
I will bring that day buddy 🤞🤞
@saranshyadav66
@saranshyadav66 3 жыл бұрын
NOTE: At 4:51 Instead of selection sort bubble sort logic is used but selection sort logic was explained. Selection Sort Function is given below in c++: ************************************************** void selectionSort(int a[], int n){ for(int i = 0; i < n-1; i++){ int min = i; for(int j = i+1; j < n; j++){ if (a[min] > a[j]) min = j; } int temp = a[i]; a[i] = a[min]; a[min] = temp; } }
@khushinautiyal1858
@khushinautiyal1858 Жыл бұрын
doing god's work
@aimld28_utkarshpandey41
@aimld28_utkarshpandey41 Жыл бұрын
kzbin.info/www/bejne/rpSzd4h5nZWdipI Bubble sort is this bro!
@coderfek
@coderfek Жыл бұрын
Good job. This is hell of a confusion .
@nitikadhiman5068
@nitikadhiman5068 Жыл бұрын
was looking for this comment only... galat code btaya hai
@__idyllist
@__idyllist Жыл бұрын
Actually this one is right
@sumitsharma6738
@sumitsharma6738 3 жыл бұрын
didi ka jo josh hota hai starting hai usse mereko motivation aa jati hai seriously.......
@AkhilKumar-zo4rh
@AkhilKumar-zo4rh 3 жыл бұрын
Bhaiya kisi din apni kaksha + apna college ke sabhi teachers ke saath ek video bnao naa...(face reveal and their intros)....vo sb ki kaafi mehnat kr rhe h unka thoda fame to bnta h...
@suman-majhi
@suman-majhi 3 жыл бұрын
He is following Robert Kiyosaki rules
@vathsan3906
@vathsan3906 3 жыл бұрын
@@suman-majhi what is that?
@suman-majhi
@suman-majhi 3 жыл бұрын
@@vathsan3906author of Rich dad, poor dad....a book...just search for it bro
@NITISHKUMAR-tr9bc
@NITISHKUMAR-tr9bc 3 жыл бұрын
@Akhil Kumar seeedhe seedhe bolo na bhai ki jo mam padha rhi hai usko dekhna hai 😂😂😂😂😂😂😂😂😂😂😂😂😂
@vathsan3906
@vathsan3906 3 жыл бұрын
@@suman-majhi which rule?
@Vishwadeep_ceo
@Vishwadeep_ceo 3 жыл бұрын
to make This 8 :32minute of video it has taken atlest 2 days for the whole process like animation , index, etc. Give a big like for all the educators of apni kaksha . 👇 👇
@ApnaCollegeOfficial
@ApnaCollegeOfficial 3 жыл бұрын
It takes us 2 days to make a 7-8 min video. Script + Shoot + Edit + Animate + Edit + Review + Notes
@KodiLearn
@KodiLearn 3 жыл бұрын
2 hrs mai toh mere jaisa simple videos vi complete nahi hota 😂🤣
@pradhumangupta8469
@pradhumangupta8469 3 жыл бұрын
Bhai 2hr really ?? Very bad guess, it took more than 1 working day for such short video ( I know coz I m plus student and he told us in casual talks)
@Vishwadeep_ceo
@Vishwadeep_ceo 3 жыл бұрын
@@ApnaCollegeOfficial yes sir . I totally agree with u
@niladriroy1665
@niladriroy1665 3 жыл бұрын
@@Vishwadeep_ceo edit kar diya.... 2hrs ko 2 days kar diya. 🤣🤣
@sachijoshi9161
@sachijoshi9161 3 жыл бұрын
The way you explain is amazing. you make the concepts so easy understand. Thanks
@__idyllist
@__idyllist Жыл бұрын
In coding you have to learn how to rewrite the concept in code. Probably/almost all are aware about the concept. But don't know how to implement and she has written a wrong code. Once you try by yourself you'll know! Thank me later!
@ggv-informationtechnology6645
@ggv-informationtechnology6645 3 жыл бұрын
Please have a look at selection sort algorithm. It seems that algorithm doesn't match with your implemented code in the given notes
@simranarora3864
@simranarora3864 2 жыл бұрын
When I did dry run- When i = 1 and j loop was going on from 2,3,4,5 Three swapping took place Which is not the case of selection sort you told in theory
@shivammaurya3451
@shivammaurya3451 3 жыл бұрын
Thank u mam and aman bhaiya mam u're explanation helps a lot to understand the concept thank u mam
@mohdakib8448
@mohdakib8448 3 жыл бұрын
frequency of video is just awesome your consistency and hard work will pay off best of luck everyone
@jaymeenjogiya8798
@jaymeenjogiya8798 3 жыл бұрын
I think there is a conflict in the theory of the selection sort vs the code , code looks like bubble sort
@rounaksharma9091
@rounaksharma9091 3 жыл бұрын
yea i feel the code is wrong ,its bubble sort code
@rakesharigela7337
@rakesharigela7337 3 жыл бұрын
@@rounaksharma9091 yes
@hhhhhhhhh963
@hhhhhhhhh963 2 жыл бұрын
Agreed
@AbhishekKumar-nz9dn
@AbhishekKumar-nz9dn 2 жыл бұрын
she didn't also clarify by telling us the explanantion of the code
@hhhhhhhhh963
@hhhhhhhhh963 2 жыл бұрын
@@AbhishekKumar-nz9dn Explanation is correct, Code is not upto the flowchart provided by GFG. We can't expect everything as top notch from a well structured free course😂
@shreyaschavhan5522
@shreyaschavhan5522 3 жыл бұрын
Notes - Selection Sort - Concept - [1:10] Selection Sort - Algorithm - [3:50] Selection Sort - Code - [4:40] Brain Teaser - [6:45]
@ritikshrivastava9442
@ritikshrivastava9442 3 жыл бұрын
thankyou bhai tu har video me ye hi comment mar raha hai
@shubhsYT
@shubhsYT 3 жыл бұрын
@@ritikshrivastava9442 nalla h na islie
@subhanjanbasu4642
@subhanjanbasu4642 3 жыл бұрын
@@shubhsYT tera baap jaisa
@sanketsingh5555
@sanketsingh5555 3 жыл бұрын
@@subhanjanbasu4642 na tere baap jaisa
@science2564
@science2564 2 жыл бұрын
@@sanketsingh5555 na tere baap jaisa teri profile se he lg rha hai
@AnkitKumar-zx9nh
@AnkitKumar-zx9nh 3 жыл бұрын
20th video is private , what happened to that one
@shoebilyas5368
@shoebilyas5368 3 жыл бұрын
lol good one XD
@hassaanraheem5644
@hassaanraheem5644 3 жыл бұрын
Wo Kal public hogi bubble sort topic hai.
@hassaanraheem5644
@hassaanraheem5644 3 жыл бұрын
@KZbinr Muntazir Bhai KZbin Mai agr aap chahte ho ko koi video specific time pr upload ho tu aap timer lgakr chor dety ho or wo video playlist mai jaga leleti hai lkin private rehti hai tb tk jb tk uploadation ka time nhi hojata.
@ayushmansharma1402
@ayushmansharma1402 3 жыл бұрын
Ma'm it is not a selection sort ,yes your explanation is correct for the selection sort but u had did coding of bubble sort in the video , because we can see that in the coding ,the continious swapping is going on for each iteration. But if we talk about selection sort , than the swapping occurs only 1 time for each iteration ...... // selection sorting ....... #include using namespace std; int main(){ int n; cout
@top7gram567
@top7gram567 3 жыл бұрын
I agree with you bro
@THEELECTRICGUY
@THEELECTRICGUY 3 жыл бұрын
There is a small mistake in the video!!! If you look at the stepwise output(of array sorting) of the outer loop, then you will find that the working of the code is not the same as explained via the video!!!! Here is the correct code for that: int small,s,count; for(int i=0; i
@sakshamarora9122
@sakshamarora9122 3 жыл бұрын
I think the code in the video is correct. If we aren't able to find the smallest element then there will be no swapping because we have a if statement judging it. And also the swapping takes place inside the scope of if statement.
@sakshamarora9122
@sakshamarora9122 3 жыл бұрын
@@THEELECTRICGUY wait I need to code it now.
@_rahulsain
@_rahulsain 3 жыл бұрын
@@THEELECTRICGUY whats the difference , it will take same time
@THEELECTRICGUY
@THEELECTRICGUY 3 жыл бұрын
@@_rahulsain Selection sort, bubble sort and insertion sort have same time complexity(ie O n^2)but have different internal working according to the theory. The code you write should clearly define which sorting method you are using.
@_rahulsain
@_rahulsain 3 жыл бұрын
@@THEELECTRICGUY you didnt change the logic, you changed the code a bit but it is working as in video i see no difference
@ajayarjunwadkar4808
@ajayarjunwadkar4808 3 жыл бұрын
mam in outer loop there should be i
@Risheendra
@Risheendra 3 жыл бұрын
I did my Btech in IT from private college, but no one taught me like this. Thanks mam..you are best.
@Samconery
@Samconery Жыл бұрын
Nice lecture. But one thing I would like to add is you need to explain the WHY? For example why do we end the first loop before n-1 and why we start the second loop after the first element. Computer Science students will know why because they can cross learn with college but other students will not be able to. The why is important to understand to remember the concepts forever otherwise it will cause confusion far into the future. This was a relatively simpler topic but more advanced will require the need to understand WHY?
@shabdsaran5131
@shabdsaran5131 3 жыл бұрын
Thank you very much sir,you are the one who's thinking is epic. May you stay happy all over your life and also very very thanks to your team.🙏
@arunkumarsingh2724
@arunkumarsingh2724 Жыл бұрын
Not sir she's madam😂😂😂
@zackcarl7861
@zackcarl7861 2 жыл бұрын
Question :- Why are we taking loop For(i=0;i
@supernova4467
@supernova4467 2 жыл бұрын
Exactly my question
@zackcarl7861
@zackcarl7861 2 жыл бұрын
@@supernova4467 i found out , it's because we are traversing from i=1 to i=n right , so for say 5elements , we take i=n-1 because we don't want it to compare last element to itself which would happen in i=n , so for i=n-1 we compare 4th element to 5th element
@supernova4467
@supernova4467 2 жыл бұрын
@@zackcarl7861 then the coding part is right na? It's same gfg also
@pradyumnmishra3459
@pradyumnmishra3459 3 жыл бұрын
And also thankx to all teachers who are making such a great effort. And finally with the help of your videos, I become capable of solving the given problem. Thnxx sir and mam🔥
@conquerworld_in
@conquerworld_in 3 жыл бұрын
One of the best series BUT just a simple suggestion, please show us a solution with debugging the code so that we can get a better idea, but now as series is fully made please just put a video on how to debug program so that every one of us can do that and understand every code with full Efficiency.
@AkibHussain
@AkibHussain 3 жыл бұрын
Concentrate all your thoughts on the task at hand. The sun's rays do no burn untill brought to a focus.
@jagritiyadavv
@jagritiyadavv 3 жыл бұрын
Nice quote.
@devashreesharma3865
@devashreesharma3865 3 жыл бұрын
The girls that explains the concept is the best. She explains so well better than anybody here. And the way she explains makes me more interested in the subject and would want to do better and better day by day.
@smrutikamble7255
@smrutikamble7255 3 жыл бұрын
This is a slow and understandable video ..Di pls keep this speed as it is😃💙
@pradhyumnasinghrathore7677
@pradhyumnasinghrathore7677 3 жыл бұрын
Selection sort is that sorting technique in minimum no of swapping is required nearly n swap required to sort entire array but in your case no of swapping is n*(n-1)/2.
@sumitchandola7126
@sumitchandola7126 3 жыл бұрын
I think , this is almostly same like insertion sort....
@LASTWOLF
@LASTWOLF 3 жыл бұрын
Write an algorithm to find the longest sequence in order(ascending) from the given array: {23, 65, 15, 43, 10, 25, 35, 42, 18} and print the sequence. Write a C program for the same.
@virendrapratapsingh6825
@virendrapratapsingh6825 6 ай бұрын
In the selection sort if you swap every time you get an < then it will take too much time and space try taking minimum element first then swap it with arr[i]
@sasikirane1638
@sasikirane1638 3 жыл бұрын
May be the code was of bubble sort instead of selection sort🙏
@amantarar9077
@amantarar9077 3 жыл бұрын
iss comment ko top parr lao,otherwise padhne walon ko confusion hoegi
@AbhishekKumar-nz9dn
@AbhishekKumar-nz9dn 2 жыл бұрын
yes bhai ,definately gadbad hai
@talhabinsiam4757
@talhabinsiam4757 3 жыл бұрын
learn this selection sort very easy and effective way from this channel.Thank you so much mam.
@nikitasharma2069
@nikitasharma2069 3 жыл бұрын
For those pals who noticed that the code doesn't match with the explaination. Here's the correct code of selection sort: #include using namespace std; int main(){ int n; cin>>n; int array[n]; for (int i = 0; i < n; i++) { cin>>array[i]; } for (int i = 0; i < n; i++) { int min = array[i]; int loc = i; for (int j = i+1; j < n; j++) { if (min > array[j]) { min = array[j]; loc = j; } } int temp = array[i]; array[i] = array[loc]; array[loc] = temp; } for (int i = 0; i < n; i++) { cout
@manthanpatil2268
@manthanpatil2268 2 жыл бұрын
Thanks btw!
@nikitagaikwad2788
@nikitagaikwad2788 2 жыл бұрын
Thx dear
@GULLAPUDILIKITHBCE
@GULLAPUDILIKITHBCE 2 жыл бұрын
what is the use of min variable? #include using namespace std; int main() { int arr[5]={3,4,2,1,-100}; for(int i=0;i
@Ahmad-zm6rk
@Ahmad-zm6rk 2 жыл бұрын
Voice in beginning and ending is very different .Aisa lga jaise didi ki jgh koi or h Lekin end me didi hi thi By the way didi ne smjhaya bht accha And concept is now clear
@doitwithease4111
@doitwithease4111 3 жыл бұрын
guys is there any person following this course seriously and would like to help me in clearing some doubts....i mean we can discuss our doubts related to this course cuz i am doing C++ for the very first time and i encounter doubts and there is no one to clear them....i have many doubts in video 6.3.......
@pranayraj8945
@pranayraj8945 3 жыл бұрын
What kind of doubts do you have..??
@shauryarana502
@shauryarana502 3 жыл бұрын
I can try to ans.
@adityaswarup4011
@adityaswarup4011 3 жыл бұрын
yup...i am an expert .. feel free to ask your doubts???
@rishikeshkumar7275
@rishikeshkumar7275 3 жыл бұрын
Yes
@doitwithease4111
@doitwithease4111 3 жыл бұрын
@@pranayraj8945 in video 6.3 bhaiya explained decimal to binary conversions etc....i couldnt understand all those things....if u r on instagram then kindly add me "aakarshmiglani" this is my insta id.....we can discuss over there....or can even call if u r comfortable with it
@LifewRoshu
@LifewRoshu 2 жыл бұрын
Thank you so much AMAN BHAIYA and the whole team of APNA COLLEGE ❤️❤️✨✨
@nickrathee8891
@nickrathee8891 Жыл бұрын
@ 8:23 ----- (15 buyed) + (5 from wrapper of 15)+ ( 1 choco from 3 wrapper 2 wrapper left) + (buy 1 additional to get 1 wrapper so total we can have 3 wrapper) + (1 choco from 3 wrapper) - total = 23
@Bharatkumar-z3b
@Bharatkumar-z3b Ай бұрын
Your Voice is sooo humble and good !!!!
@035asadali8
@035asadali8 2 жыл бұрын
when i start programming and see these videos ,i thought wth is happening now i can understand so easily .
@Saurabh-jv7pf
@Saurabh-jv7pf 2 жыл бұрын
I'm totally confused with the code. It's like a bubble sort but it's neither bubble sort nor selection sort. But the code works very well.
@ganbare242
@ganbare242 Жыл бұрын
instead of using temp, we can just use - swap(arr[i], arr[j]); swap is a built-in function in cpp
@13__JAAT
@13__JAAT Жыл бұрын
You are right bro 🎉🎉
@i_mchick5311
@i_mchick5311 3 жыл бұрын
we've only 15 RS. so we invested it to purchase 15 chocolates , then we purchased 15/3=5 more chocolates from wrappers . again from 5 chocolates we purchased 1 more ch leaving behind 2 wrappers. Total= 15+5+1=21 ch (2 wrappers left) Now tell me how can u purchase the last chocolate without having even a penny since u mentioned in the beginning we had 15 Rs only. ????? :)
@_AKASHNAIR
@_AKASHNAIR 3 жыл бұрын
its mostly an error in their script ,and its acceptable they were trying to maintain quality content while without comprmising on time
@meme-qw6hl
@meme-qw6hl 3 жыл бұрын
Last chocolate wrapper+ 2 left wrapper =3wrappers=1chocolate
@meme-qw6hl
@meme-qw6hl 3 жыл бұрын
#Brain teaser# include using namespace std; int main() { int chocolate,price,wp; cin>>chocolate>>price>>wp; int c=chocolate/price; int eat=0; int m=0; while(c>0) { eat=eat+c; m=m+c; c=m/wp; m=m%wp; } cout
@_AKASHNAIR
@_AKASHNAIR 3 жыл бұрын
@@meme-qw6hl so in the end only 21 choclates and 2 wrappers will be left right?
@meme-qw6hl
@meme-qw6hl 3 жыл бұрын
@@_AKASHNAIR no 22 chocolate and 0 wrapper
@Matzzy09
@Matzzy09 3 жыл бұрын
seems the journey is big with apna college
@AjitKumar-bk5oe
@AjitKumar-bk5oe 3 жыл бұрын
I am in midst of confusion state.....Someone hold me and bring back to shore of confident state. Selection sort was described as sorting process in which we find minimum value in array and then swap the values with the required index in this video. But I cant find anywhere in code regarding finding the minimum value , swapping is just done instantaneously with the next value if next value is small. Correct me if I am wrong ☺
@akshyatankur
@akshyatankur 3 жыл бұрын
It does check minimum See if you check the next two numbers then if second one is small then it will swap it with first one and this process is carried for the whole I sorted array or loop, thus, making the minimum of the unsorted array to go to the first position
@vaibhavagrawal6702
@vaibhavagrawal6702 3 жыл бұрын
Mam i think apne Selection sort ki coding me apne bubble sort ki coding btadi...
@chirantanacharyya822
@chirantanacharyya822 3 жыл бұрын
Yeah you are absolutely right
@prernachoudhary2197
@prernachoudhary2197 3 жыл бұрын
Keep the spiritual high bhiya and team ...may god bless you.. And brain teaser was amazing ....
@shardulrastogi4369
@shardulrastogi4369 2 жыл бұрын
Waah maza aagya, once upon a time, I used fear with this!
@dits745
@dits745 3 жыл бұрын
Thank you Aman bhaiya😀😊
@aayshachouhan7985
@aayshachouhan7985 Жыл бұрын
My Sir taught me in very difficult way ,but u make it easy..Thanks
@parthpanchal815
@parthpanchal815 Жыл бұрын
Bro this is not the correct code of selection sort it is bubble sort
@manansinghal5634
@manansinghal5634 3 жыл бұрын
THIS IS NOT EXACTLY SELECTION SORT IN SELECTION SORT THE WE DO NOT CHANGE EVERY ELEMENT SMALLER THAN THE I INDEX....WE JUST HAVE TO CHANGE THE SMALLEST. ELEMENT WITH I INDEX.......PROVE-SUPPOSE THE INITIAL ARRAY IS 45 12 23 51 19 8 ......but after the completion of j loop for the first time the array will be 8 45 23 51 19 12 but the array should be 8 12 23 51 19 45.
@AbhishekKumar-nz9dn
@AbhishekKumar-nz9dn 2 жыл бұрын
yes ,gadbad hai
@ashutoshkashyap7184
@ashutoshkashyap7184 2 жыл бұрын
This is actually bubble sort. Hover to 4:25 then match the line of array with the code. The line will actually become 8 23 45 51 19 12 instead of 8 12 23 51 19 45. The correct selection sort code is this : #include using namespace std; int main(){ int n; cin>>n; cout
@ashutoshkashyap7184
@ashutoshkashyap7184 2 жыл бұрын
Buddy see the code
@mahima_786
@mahima_786 Жыл бұрын
The code is making confusion as nearby elements are swapped but it is not a bubble sort.The confusion is arriving as logic and code is different.
@user-nm4vn9tq5o
@user-nm4vn9tq5o 3 жыл бұрын
Wtf man, this code isn't sorting the array.Irony is how confidently you post this video without even cross checking.
@ydafukomi
@ydafukomi 5 ай бұрын
I tried it, and guess what? IT WORKED. Maybe just double check your code before confidently posting shitty comments from next time on❤
@Justforknowledge6204
@Justforknowledge6204 5 ай бұрын
Bhai ye selection sort ke jagah bubble sort ka code laga di hai ye galat hai
@dipanjanchatterjee7874
@dipanjanchatterjee7874 2 ай бұрын
​@@Justforknowledge6204pehele aap sikhke aao ke kaun sa selection sort hai aur kaun sa bubble sort hai😒😒😒😂 Ye bilkul thik hai
@badavaththarun7006
@badavaththarun7006 3 жыл бұрын
I think the code here is not the same as the concept explained In the video, it works fine. But the problem is it does not find the minimum element in the unsorted array, it just finds the element smaller than ar[i] in the unsorted part ex : 10 3 4 5 -1 6 hereafter the first iteration, we want it to be -1 3 4 5 10 6 but the code gives 3 10 4 5 -1 6. I've implemented the code #include using namespace std; void selection_sort(int ar[], int n) { // find the min in the remaining part and swap it. int min_index; for (int i = 0; i < n-1; i++) { // set min index to i min_index = i; for (int j = i + 1; j < n; j++) { // if element is less than ar[min_index] set min_index = j if (ar[j] < ar[min_index]) { min_index = j; } } swap(ar[i],ar[min_index]); } for (int i = 0; i < n; i++) { cout > ar[i]; } selection_sort(ar, n); }
@sdaks001
@sdaks001 2 жыл бұрын
Yeah you're correct its just comparing two numbers and updating the lesser one at index 0
@pranav_1056
@pranav_1056 3 жыл бұрын
Bhaiya just a reminder( I know you definately remeber) Please upload the notes of previous video They aren't uploaded yet 🙏🙏
@kartikeyadubey1266
@kartikeyadubey1266 3 жыл бұрын
Yes yes bhaiya , where can we find those notes.
@smile8510
@smile8510 3 жыл бұрын
teaching in such a simple way is awesome.
@itshiraljain
@itshiraljain 3 жыл бұрын
There is some mistake in selection sort code, we aren't optimizing no. of swaps, the correct code should be like this: for (int i = 0; i < n-1; i++) { int min = i; for (int j = i+1; j < n; j++) { if (arr[j] < arr[min]) { min = j; } } if (min != i) { swap(arr[min], arr[i]); } }
@harharmahadev1038
@harharmahadev1038 3 жыл бұрын
can you explain what you meant by saying that and this part... if (min != i) { swap(arr[min], arr[i]); }
@itshiraljain
@itshiraljain 3 жыл бұрын
@@harharmahadev1038 What actually happens in selection sort is that we have to find minimum element and swap it with the first element of unsorted array, i.e. all smaller elements will come at beginning in ascending order. Now if "min" is not equal to "i" it means that beginning element of unsorted array and min element are different that is why we need to swap both of them. swap function is present in bits/stdc++ library, u can simply include the library and use the function instead of taking temp variable...
@muntasirsunny
@muntasirsunny 3 ай бұрын
It's not selection sort, it's bubble sort. Theoretically you explained that inside the array you need to find the minimum and swap with the index element but in your code did you write the logic of finding that minimum element? No, you didn't.
@anuragkumarsharma3926
@anuragkumarsharma3926 3 жыл бұрын
This code have one problem , We don't have to swap everytime when we get smaller number but only when we get smallest element in the unsorted array. according to the code output will be i guess {3,6,2,7,9}. Correct me guys if i am wrong
@kashyapanuragi8987
@kashyapanuragi8987 3 жыл бұрын
Ni bhai code sahi h Lekin lekin har baar swap karne ki jaroorat ni h, keval jab minimum mile tab short kar sakte the
@user-nm4vn9tq5o
@user-nm4vn9tq5o 3 жыл бұрын
Yes bro you are right, their code isn't working
@usmanaliansari5223
@usmanaliansari5223 2 жыл бұрын
Code galat hai Selection sort ka
@developerNik
@developerNik Жыл бұрын
Selection sort is the method in which we find the min element in an sorted array and swap it with the beginning of the unsorted array. Nested loops hote hai do jisme se pehla wala 0 se n-1 aur dusra wala i se n chalta hai them we compare and swap. Also that chocolates wala concept was right i forgot about that last chocolate.
@avarts4432
@avarts4432 11 ай бұрын
Exactly we keep min =i and then proceed with the code
@rahulprasad3575
@rahulprasad3575 3 жыл бұрын
selection sort code was different as it explained
@sampadsadhu4371
@sampadsadhu4371 3 жыл бұрын
Yes I was confused at first
@yashchauhan7221
@yashchauhan7221 3 жыл бұрын
it is bubble sort which is shown in code not selection
@chiragkakwani3174
@chiragkakwani3174 3 жыл бұрын
No 1 step has been missed
@ramakp34
@ramakp34 3 жыл бұрын
@@yashchauhan7221 can u tell the code of selection sort
@yashchauhan7221
@yashchauhan7221 3 жыл бұрын
@@ramakp34 Ofcourse Dude #include using namespace std; int main() { int tot, arr[50], i, j, temp, small, chk, index; couttot; cout
@divyamharbola6876
@divyamharbola6876 3 жыл бұрын
Everyone do like man, They are providing Platinum for free.
@ojasahirrao3287
@ojasahirrao3287 2 жыл бұрын
In the second step, 23 is less than 45, so according to your code they both should get swapped. How come 12 is getting swapped with 45? There is no code written to find the smallest number in [45, 23, 51, 19, 12]
@ashutoshsagar837
@ashutoshsagar837 Жыл бұрын
yes, no code is written to find the minimum here as according to the definition we have to find the minimum and then swap it with the beginning element of the unsorted array.
@aakashmodi441
@aakashmodi441 3 жыл бұрын
Didi ek baat batao agar i
@sahilrana11
@sahilrana11 3 жыл бұрын
thankyou sooo much it helped me a lot. you all are awesome more power to u.
@susheelsahu8759
@susheelsahu8759 Жыл бұрын
answer to the chocolate problem: int main(){ int r = 15; int c = 1; int counter = 0; while(r>0){ r = r-c; counter+=1; if(counter%3==0){ r = r+c; } } cout
@masq_ashfaq4736
@masq_ashfaq4736 3 жыл бұрын
I can buy 21 chocolate. Even after 21 chocolate still, I have 2 chocolate wrappers. thanks ma'am this video is so helpful and one comments for u, ur voice is very sweet.
@osamabinkarim1663
@osamabinkarim1663 2 жыл бұрын
furqan sayyad ki tarf sy apko slaam..ap boht acha parhati hain
@pranavsingh9573
@pranavsingh9573 3 жыл бұрын
Aap c programming k videos bhi dala karo plz🙏🙏
@shaikwaseemahmed.5510
@shaikwaseemahmed.5510 3 жыл бұрын
Thanks date to date videos thanks aman dattarwal and team
@manavkampani8367
@manavkampani8367 3 жыл бұрын
Code for the puzzle at the end: #include using namespace std; int main() { cout n; int rate; cin>>rate; int total_chocs=n; int rem_wraps{0}; int new_wraps=n; int new_chocs{0}; while(new_wraps+rem_wraps>=3) { new_chocs=(new_wraps+rem_wraps)/3; rem_wraps=(new_wraps+rem_wraps)%3; new_wraps=new_chocs; total_chocs=total_chocs+new_chocs; } cout
@SajjadAhmed-lc2dr
@SajjadAhmed-lc2dr 3 жыл бұрын
behtarenn
@ayushpathak1638
@ayushpathak1638 2 жыл бұрын
this one is better i think #include using namespace std; int main(){ int count=0; for(int i=0;i
@niknurulhuda3018
@niknurulhuda3018 2 жыл бұрын
thank you sister. im finally done with my coding
@tarunparashar4505
@tarunparashar4505 3 жыл бұрын
Liked the video and was the first viewer without even being in college 😂😂😂. Btw class 12th student.
@amanagnihotri6794
@amanagnihotri6794 Жыл бұрын
Mind-blowing 😍
@unnati.jain_
@unnati.jain_ 2 жыл бұрын
source code for finding maximum no. of chocolates #include using namespace std; int main(){ int n; cin>>n; int choco=1*n; int wrapper=choco; int w; while(wrapper>0){ w=wrapper/3; if(w%3==0){ choco+=w; wrapper+=w; } else { choco+=w; wrapper+=w; w=wrapper-(w*3); } wrapper=w; } cout
@umarwaqas774
@umarwaqas774 Жыл бұрын
include using namespace std; int main() { int n=15; int tchlt; int num[n]; for(int i=n;i>3; i++) { i=i/3; tchlt+=i; } cout
@ujjawalmishra858
@ujjawalmishra858 3 жыл бұрын
Its going complicated bhaiya...But if you will explain in simple words then it can become easy...and I know you are making efforts...
@sandeshwar7407
@sandeshwar7407 3 жыл бұрын
After buying all those 22 chocolates, I'll give it to you ma'am😉😋😍
@al-baghdadi7914
@al-baghdadi7914 3 жыл бұрын
5:42 cute laugh of didi
@salahuddin13
@salahuddin13 Жыл бұрын
Time:[6:42] (Solution) #include using namespace std; int main(){ int tk,chocolates,total=0; cin>>tk; int wrappers=tk; total=tk; while (wrappers>=3) { chocolates = wrappers/3; // (14/3)=4 (6/3)=2 0 int rem= wrappers%3; //2 0 total+=(chocolates); //14 14+4=18 18+2=20 wrappers=chocolates+rem; // 4+2=6 } cout
@uditangshuchakraborty3102
@uditangshuchakraborty3102 Жыл бұрын
thanks
@__idyllist
@__idyllist Жыл бұрын
Mam you have to explain a code like interpreter, concepts are well cleared by students. I TOOKS me 10 min to declare what the arr[i] and arr[j] is.
@OmkarOrgantiwar
@OmkarOrgantiwar Жыл бұрын
mam are u explaining urself it is too fast u only explaing the sorting very good but when u jump into the code please go slowly
@XII-SCA-08AMANKUMARSHAW
@XII-SCA-08AMANKUMARSHAW 3 ай бұрын
there is lack of explanation in this video about the code but great work , just figureing out things with next video thank you
@sakshamagarwal9116
@sakshamagarwal9116 2 жыл бұрын
The chocolate question at the end of video was asked to me in Adobe Interview😊
@my----mind4874
@my----mind4874 2 жыл бұрын
Yeah I solved that puzzle. It's very intresting.
@Islamicpoint786-k3s
@Islamicpoint786-k3s 8 ай бұрын
Who feel proud to be a part of ❤❤❤ HAZRAT MUHAMMAD SAW ❤️❤️❤️
@rutvikrana512
@rutvikrana512 3 жыл бұрын
Selection sort in this video ....💕 Left in Queue: - Insertion sort - Bubble sort - Merge sort - Quick sort - Heap sort - Counting sort - Radix sort - binary tree sort - and many more .....
@pranayakhand1535
@pranayakhand1535 3 жыл бұрын
You Guys are Awesome yrr ... Your Video are so much helpfull for us...keep going guys ❤️
@amansinghal4663
@amansinghal4663 3 жыл бұрын
In the chocolates question, if your first answer was 20, then you are my best friend🙂
@relaxandsleepmusic809
@relaxandsleepmusic809 3 жыл бұрын
it's very simple java collection.sort(Array);
@shivangbhargava7729
@shivangbhargava7729 2 жыл бұрын
microsoft wali didi aagai
@shrejalgupta9520
@shrejalgupta9520 3 жыл бұрын
didi.....brain teasers are in demand... please give us more
@bishanpawar1513
@bishanpawar1513 2 жыл бұрын
when we buy 1 extra choclate for adding a wrapper then that choclate should also be counted, then at last we should have 23 choclates.
@bishanpawar1513
@bishanpawar1513 2 жыл бұрын
And in the starting of the puzzle you said that we have 15 rupees,then how can we buy 1 more choclate for that remaining wrapper.
@ujjawalmishra858
@ujjawalmishra858 3 жыл бұрын
Today I have understood Selection Sorting...Thank You Ma'am
@dharsan.s7937
@dharsan.s7937 3 жыл бұрын
this brain teaser question i saw in hackerrank algorithms questions
@_rahulsain
@_rahulsain 3 жыл бұрын
it was so easy
@arslanali5209
@arslanali5209 3 жыл бұрын
Kindly make a lecture on list using array entirely
@ritiksahu5310
@ritiksahu5310 3 жыл бұрын
code for chocolate question int noc(int money){ int chocolate= money; int rapper = chocolate; while(rapper>=3){ chocolate+=rapper/3; rapper=rapper/3+rapper%3; } return chocolate; }
@Mohak_00
@Mohak_00 3 жыл бұрын
please make this understand in detail that why are you using a loop at any place and what's the reason to initialize it from a particular value
@itihaskumar3523
@itihaskumar3523 2 жыл бұрын
5:41 love this moment💕💕
@varunpurohit57
@varunpurohit57 3 жыл бұрын
ye jo codes h bahut badiya h magar ek problem thi.... ye code likhne k baad code bhi explain kr do thoda mtlb jaise i=1 hai toh vo progression aage kaise jayega wo bta do thoda aur maza aa jayega
@wadood_ul_islam6637
@wadood_ul_islam6637 2 жыл бұрын
really helpfull in exams thanks
8.3.2 Bubble Sort | Sorting in C++ | Guaranteed Placement Course
6:46
LIFEHACK😳 Rate our backpacks 1-10 😜🔥🎒
00:13
Diana Belitskay
Рет қаралды 3,9 МЛН
Поветкин заставил себя уважать!
01:00
МИНУС БАЛЛ
Рет қаралды 6 МЛН
哈莉奎因怎么变骷髅了#小丑 #shorts
00:19
好人小丑
Рет қаралды 53 МЛН
The joker favorite#joker  #shorts
00:15
Untitled Joker
Рет қаралды 30 МЛН
7.4 Insertion Sort Algorithm |Explanation with C Program| Data Structure Tutorials
28:13
IIT-JEE Toppers: Where Are They Now?
16:07
Mohak Mangal
Рет қаралды 1,1 МЛН
you will never ask about pointers again after watching this video
8:03
DSA & ₹1.2 Crore Per Annum Jobs - The Truth? (No Offence)
12:22
CodeWithHarry
Рет қаралды 656 М.
7.3 Bubble Sort Algorithm| Data Structures Tutorials
35:36
Jenny's Lectures CS IT
Рет қаралды 1,5 МЛН
Bubble Sort Algorithm in Hindi
32:22
CodeWithHarry
Рет қаралды 352 М.
Learn Merge Sort in 13 minutes 🔪
13:45
Bro Code
Рет қаралды 302 М.
LIFEHACK😳 Rate our backpacks 1-10 😜🔥🎒
00:13
Diana Belitskay
Рет қаралды 3,9 МЛН