Notes of this video: drive.google.com/file/d/1zkOX... Apni Kaksha Instagram: / apnikaksha Apni Kaksha Telegram: t.me/apnikakshaofficial
Пікірлер: 1 100
@dippelarc89973 жыл бұрын
✤People will throw stones at you. Don't throw them back. Collect them all and build and empire.✤ Thank You A.D.
@ChiruVishnoi180820033 жыл бұрын
kzbin.info/www/bejne/sKO4nImln6h5Zs0
@sauravrawat55873 жыл бұрын
😂😂
@shrutidas3593 жыл бұрын
why people will throw stones at her🤔🤔🤔
@ashutoshharma3 жыл бұрын
they had us in the first half
@starkendeavours70723 жыл бұрын
Lovely...dil khush ho gya ye sunke❤️❤️❤️
@THEELECTRICGUY3 жыл бұрын
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
@sakshamarora91223 жыл бұрын
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.
@sakshamarora91223 жыл бұрын
@@THEELECTRICGUY wait I need to code it now.
@_rahulsain3 жыл бұрын
@@THEELECTRICGUY whats the difference , it will take same time
@THEELECTRICGUY3 жыл бұрын
@@_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.
@_rahulsain3 жыл бұрын
@@THEELECTRICGUY you didnt change the logic, you changed the code a bit but it is working as in video i see no difference
thankyou bhai tu har video me ye hi comment mar raha hai
@shubhsYT2 жыл бұрын
@@ritikshrivastava9442 nalla h na islie
@subhanjanbasu46422 жыл бұрын
@@shubhsYT tera baap jaisa
@sanketsingh55552 жыл бұрын
@@subhanjanbasu4642 na tere baap jaisa
@science25642 жыл бұрын
@@sanketsingh5555 na tere baap jaisa teri profile se he lg rha hai
@nikhillodhi74273 жыл бұрын
Will watch all these videos after my board examinations... Now came here to give a like for there hardwork👍👍
@ChiruVishnoi180820033 жыл бұрын
Me to. From which board are you
@ChiruVishnoi180820033 жыл бұрын
I am from cbse board
@Pratyush_Srivastava243 жыл бұрын
CBSE , same here
@soniabhatia98533 жыл бұрын
Same
@krishjani96293 жыл бұрын
Same here.... From Gujarat boards
@saranshyadav662 жыл бұрын
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 Жыл бұрын
doing god's work
@aimld28_utkarshpandey41 Жыл бұрын
kzbin.info/www/bejne/rpSzd4h5nZWdipI Bubble sort is this bro!
@coderfek10 ай бұрын
Good job. This is hell of a confusion .
@nitikadhiman506810 ай бұрын
was looking for this comment only... galat code btaya hai
@__idyllist8 ай бұрын
Actually this one is right
@musicenjoyer42023 жыл бұрын
You guys are putting so much effort, without EXPECTING. It makes me feel indebted to you guys and makes me work harder so your efforts don't go in vain
@delhuniversity2 жыл бұрын
can you please find error in the prog
@nepaliladka85262 жыл бұрын
@Harshil Pandey #include using namespace std; int main() { int n ; cin>>n; int arr[n]; for(int i=0;i>arr[i]; } for (int i = 0; i < n-1; i++) { int min = i; for (int j = i + 1; j
@pradyumnmishra34593 жыл бұрын
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🔥
@Vishwadeep_ceo3 жыл бұрын
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 . 👇 👇
@ApnaCollegeOfficial3 жыл бұрын
It takes us 2 days to make a 7-8 min video. Script + Shoot + Edit + Animate + Edit + Review + Notes
@KodiLearn3 жыл бұрын
2 hrs mai toh mere jaisa simple videos vi complete nahi hota 😂🤣
@pradhumangupta84693 жыл бұрын
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_ceo3 жыл бұрын
@@ApnaCollegeOfficial yes sir . I totally agree with u
@niladriroy16653 жыл бұрын
@@Vishwadeep_ceo edit kar diya.... 2hrs ko 2 days kar diya. 🤣🤣
@KrishnaGupta-dd1mo3 жыл бұрын
The things which looks tough in college are now looks easy . Thanks to Apna College Team
@rounakghosh4693 жыл бұрын
Waiting for the day when educational videos will start trending in KZbin ❤️
@AbhishekKumar-nz9dn2 жыл бұрын
india me chapri bohot bhare hue hai ,jinka education se koi lena dena nhi hai .
@hatcoder Жыл бұрын
I will bring that day buddy 🤞🤞
@shabdsaran51313 жыл бұрын
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.🙏
@arunkumarsingh27249 ай бұрын
Not sir she's madam😂😂😂
@sumitsharma67383 жыл бұрын
didi ka jo josh hota hai starting hai usse mereko motivation aa jati hai seriously.......
@mohdakib84483 жыл бұрын
frequency of video is just awesome your consistency and hard work will pay off best of luck everyone
@jayasrivastava42203 жыл бұрын
Aman Bhaiya your video is used to be so amazing ki kisi chote bacche ko bhi samajh aa jaye. My daughter is in 8 standard but infact she is able to understand the topic Of higher classes and now learning c++. Hats off to you!!!
@devashreesharma38652 жыл бұрын
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.
@talhabinsiam47573 жыл бұрын
learn this selection sort very easy and effective way from this channel.Thank you so much mam.
@saurabhshandilay82613 жыл бұрын
This does not seem like selection sort rather it is more like bubble sort but in reverse order. Because in selection sort u find the min element and swap it with the first element, so there is only one swap in each iteration, but in your case there are n, n-1, n-2... swaps with every iteration same as bubble sort.
@user-zw1xp7it3o3 жыл бұрын
Yes you are right ... they have used another sorting algorithm as Selection Sort
@rishaadkhan69953 жыл бұрын
actually, they have used selection sort but with two pointers.
@C_mee2 жыл бұрын
instead of finding a minimum of all the element in second loop, here the minimum is itself being stored in arr[i], this works fine but this is not in adherence to the theory of selection sort.
@adityarawat9338 Жыл бұрын
@@rishaadkhan6995 where is the pointers?
@sachijoshi91612 жыл бұрын
The way you explain is amazing. you make the concepts so easy understand. Thanks
@__idyllist8 ай бұрын
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!
@ajayarjunwadkar48083 жыл бұрын
mam in outer loop there should be i
@smile85102 жыл бұрын
teaching in such a simple way is awesome.
@shivammaurya34513 жыл бұрын
Thank u mam and aman bhaiya mam u're explanation helps a lot to understand the concept thank u mam
@abhayranjan58783 жыл бұрын
Add more puzzles.. these are really interesting ❤️❤️
@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
@pranayakhand15353 жыл бұрын
You Guys are Awesome yrr ... Your Video are so much helpfull for us...keep going guys ❤️
@LASTWOLF2 жыл бұрын
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.
@smrutikamble72553 жыл бұрын
This is a slow and understandable video ..Di pls keep this speed as it is😃💙
@LifewRoshu2 жыл бұрын
Thank you so much AMAN BHAIYA and the whole team of APNA COLLEGE ❤️❤️✨✨
@ggv-informationtechnology66452 жыл бұрын
Please have a look at selection sort algorithm. It seems that algorithm doesn't match with your implemented code in the given notes
@kiranp58283 жыл бұрын
These guys are just amazing.And they were doing such a great work. They were giving a very quality education for free. Please guys support them all.🙏🙏🙏
@aryansharma-wf8sn3 жыл бұрын
Didi you make such a difficult topic so easy 😊🥰
@prernachoudhary21973 жыл бұрын
Keep the spiritual high bhiya and team ...may god bless you.. And brain teaser was amazing ....
@vidneshsharma91942 жыл бұрын
Easy explaintion thanks Di ! 😊😊 , You R best teacher in the 🌍 😇...
@sarthaknitnaware3 жыл бұрын
Awesome explanation!😍😍
@AkhilKumar-zo4rh3 жыл бұрын
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-majhi3 жыл бұрын
He is following Robert Kiyosaki rules
@vathsan39063 жыл бұрын
@@suman-majhi what is that?
@suman-majhi3 жыл бұрын
@@vathsan3906author of Rich dad, poor dad....a book...just search for it bro
@NITISHKUMAR-tr9bc3 жыл бұрын
@Akhil Kumar seeedhe seedhe bolo na bhai ki jo mam padha rhi hai usko dekhna hai 😂😂😂😂😂😂😂😂😂😂😂😂😂
@vathsan39063 жыл бұрын
@@suman-majhi which rule?
@jagjeevankashid6 күн бұрын
This is the correct implementation you have implemented the bubble sort :- for(int i=0;i
@sahilrana113 жыл бұрын
thankyou sooo much it helped me a lot. you all are awesome more power to u.
@tusharnath94023 жыл бұрын
Urvi Di teaches so damn good. All the concepts gets cleared. Thank you so much, Di and Aman Bhaiyya and team. Loads of luck and love to you!
@manthanpatil22682 жыл бұрын
Dear Teachers of Apna college, Please update the code as the code given in the video is of Bubble sort and not of Selection sort 🙂🙂
@ADEEBARASHIDBAI Жыл бұрын
try this code #include using namespace std; int main() { int n; cin>>n; int arr[n]; for(int i=0;i>arr[i]; } int temp=0; for(int i=0;i
@cosmicAK Жыл бұрын
yes
@jeetendranathmishra3701 Жыл бұрын
exactly
@muradahmad9357 Жыл бұрын
literally I've been thinking that what just really happened🥲
@fannypack7705 Жыл бұрын
It's selection sort dude
@mohammedsayeed3303 жыл бұрын
mam ki voice sunke hi dil bargaya 😍
@ganeshnaik7783 жыл бұрын
seems the journey is big with apna college
@dits7453 жыл бұрын
Thank you Aman bhaiya😀😊
@rutvikrana5123 жыл бұрын
We can use inbuilt method swap(a,b) to swap two elements. 👌
@conquerworld_in3 жыл бұрын
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.
@shivaaysinghrajput47603 жыл бұрын
Thanks for adding puzzle questions...
@simranarora38642 жыл бұрын
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
@manavkampani83673 жыл бұрын
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-lc2dr2 жыл бұрын
behtarenn
@ayushpathak16382 жыл бұрын
this one is better i think #include using namespace std; int main(){ int count=0; for(int i=0;i
@mdtipusultan78893 ай бұрын
Chocolate buying calculation was awesome 👍👍.
@freemusi20153 жыл бұрын
Sir please give brain teaser in every video.....Thank you❤️❤️❤️❤️❤️
@bcsmadhavanand2 жыл бұрын
End part puzzle was amazing 💥
@codingWorld7092 жыл бұрын
Yeah really, I have spend some time and found a general formula to calculate any numbers of chocolate.... 💓💓💓
@sameerraj58003 жыл бұрын
This was an easy brain teaser. I solved it within 10 seconds.
@rahuldravid28810 ай бұрын
Han bhai boht bdiya cool lgra hai bohttt💥
@sameerraj580010 ай бұрын
@@rahuldravid288 Are bhai itne purane comment pe reply kiya😂
@shardulrastogi43692 жыл бұрын
Waah maza aagya, once upon a time, I used fear with this!
@Dev_Bhattacharya3 жыл бұрын
love you bhaiya and its team
@jaymeenjogiya87983 жыл бұрын
I think there is a conflict in the theory of the selection sort vs the code , code looks like bubble sort
@rounaksharma90912 жыл бұрын
yea i feel the code is wrong ,its bubble sort code
@rakesharigela73372 жыл бұрын
@@rounaksharma9091 yes
@hhhhhhhhh9632 жыл бұрын
Agreed
@AbhishekKumar-nz9dn2 жыл бұрын
she didn't also clarify by telling us the explanantion of the code
@hhhhhhhhh9632 жыл бұрын
@@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😂
@AnkitKumar-zx9nh3 жыл бұрын
20th video is private , what happened to that one
@shoebilyas53683 жыл бұрын
lol good one XD
@hassaanraheem56443 жыл бұрын
Wo Kal public hogi bubble sort topic hai.
@hassaanraheem56443 жыл бұрын
@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.
@SHUBHAM23P3 жыл бұрын
thank you so much for your efforts sir
@035asadali82 жыл бұрын
when i start programming and see these videos ,i thought wth is happening now i can understand so easily .
@Risheendra3 жыл бұрын
I did my Btech in IT from private college, but no one taught me like this. Thanks mam..you are best.
@ayushmansharma14023 жыл бұрын
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
@top7gram5672 жыл бұрын
I agree with you bro
@sevenhours11372 жыл бұрын
really awesome content guys....
@niknurulhuda30182 жыл бұрын
thank you sister. im finally done with my coding
@AkibHussain3 жыл бұрын
Concentrate all your thoughts on the task at hand. The sun's rays do no burn untill brought to a focus.
@jagritiyadavv2 жыл бұрын
Nice quote.
@doitwithease41113 жыл бұрын
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.......
@pranayraj89453 жыл бұрын
What kind of doubts do you have..??
@shauryarana5023 жыл бұрын
I can try to ans.
@adityaswarup40113 жыл бұрын
yup...i am an expert .. feel free to ask your doubts???
@rishikeshkumar72753 жыл бұрын
Yes
@doitwithease41113 жыл бұрын
@@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
@sanjanasinha74773 жыл бұрын
Thanks bhaiya for uploading videos this videos are just awesome bhaiya please upload video on mca intrance exam also.
@shubhambhardwaj88943 жыл бұрын
Awesome explanation ❤
@vaibhavkesarwani26873 жыл бұрын
You don't have to swap with the every small element you get. We have to first find the index of the smallest element and then do the swap with it. Please do the correction.
@pritamsarkar33712 жыл бұрын
exactly
@priority_cute2 жыл бұрын
Yeah
@nandhinireddy2980 Жыл бұрын
Yes
@sasikirane16383 жыл бұрын
May be the code was of bubble sort instead of selection sort🙏
@amantarar90772 жыл бұрын
iss comment ko top parr lao,otherwise padhne walon ko confusion hoegi
@AbhishekKumar-nz9dn2 жыл бұрын
yes bhai ,definately gadbad hai
@rabiahafeez-cg8hz27 күн бұрын
Thanks ma'am I've seen now this video and code is clear running
@muhammadtamour2286 Жыл бұрын
While doing task I am not understanding it quite properly but after watching this video it makes me too much comfortable 😉
@phatakom3 жыл бұрын
Wait, the code looks like of bubble sort not selection sort
@top7gram5672 жыл бұрын
I agree
@udittatisar53362 жыл бұрын
Wahi to Yaar
@husler74242 жыл бұрын
so its actually a Bubble sort code? and do we need to write another for Selection sort?
@pavankumar-gp9zx2 жыл бұрын
i think it not exactly a bubble sorting code, see the next video then will get clarity
@yagamilight082 жыл бұрын
nahi...selection sort me minimum ko baar baar "select" karte hai....bubble sort me minimum khud hi "bubble up" hota hua start me aa jata hai...different hai
@rutvikrana5123 жыл бұрын
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 .....
@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?
@geetanshagrawal3 жыл бұрын
Please also explain about time complexity for the sorting algorithm
@Saurabh-jv7pf Жыл бұрын
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.
@relaxandsleepmusic8092 жыл бұрын
by the way last problem was amazing 🙌
@rudrantukirde87432 жыл бұрын
Solution is wrong
@catdog3264 Жыл бұрын
@@rudrantukirde8743 did u understand about the last one chocolate. how she brought extra chocolate. plss explain
@amanagnihotri6794 Жыл бұрын
Mind-blowing 😍
@shivam362810 ай бұрын
amazing explanation mam 😊
@isitMaaz3 жыл бұрын
I thought we have to code the brain teaser and I started doing that.....lol
@aryanagrawal6893 жыл бұрын
tu bits m hai ?
@isitMaaz3 жыл бұрын
@@aryanagrawal689 nhi
@nagatouchiha68832 жыл бұрын
Muzhe bhi yahi laga.. 1hr barbad hogaya mera😂🤣
@manansinghal56343 жыл бұрын
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-nz9dn2 жыл бұрын
yes ,gadbad hai
@sandeshwar74073 жыл бұрын
After buying all those 22 chocolates, I'll give it to you ma'am😉😋😍
@ShubhamSharma-nn3ly3 жыл бұрын
Amazing explanation
@user-nm4vn9tq5o2 жыл бұрын
Wtf man, this code isn't sorting the array.Irony is how confidently you post this video without even cross checking.
@ydafukomiАй бұрын
I tried it, and guess what? IT WORKED. Maybe just double check your code before confidently posting shitty comments from next time on❤
@Fun.Adda14329 күн бұрын
Bhai ye selection sort ke jagah bubble sort ka code laga di hai ye galat hai
@sarthaknitnaware3 жыл бұрын
Didi ki voice😍❣
@rahulsinghchauhan56342 жыл бұрын
This is very helpful for me👍👍
@VictorBose-wt7xf3 жыл бұрын
nice problem. Was able to solve it in one go.
@pranavchoudhary64913 жыл бұрын
Bhaiya just a reminder( I know you definately remeber) Please upload the notes of previous video They aren't uploaded yet 🙏🙏
@kartikeyadubey12663 жыл бұрын
Yes yes bhaiya , where can we find those notes.
@ojasahirrao32872 жыл бұрын
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 Жыл бұрын
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.
@divyamharbola68762 жыл бұрын
Everyone do like man, They are providing Platinum for free.
@salahuddin139 ай бұрын
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
@uditangshuchakraborty31029 ай бұрын
thanks
@tarunparashar45053 жыл бұрын
Liked the video and was the first viewer without even being in college 😂😂😂. Btw class 12th student.
@vaibhavagrawal67023 жыл бұрын
Mam i think apne Selection sort ki coding me apne bubble sort ki coding btadi...
@chirantanacharyya8223 жыл бұрын
Yeah you are absolutely right
@ayushmaankashyap6788 Жыл бұрын
Very adorable voice mam🥰
@aayshachouhan7985 Жыл бұрын
My Sir taught me in very difficult way ,but u make it easy..Thanks
@parthpanchal815 Жыл бұрын
Bro this is not the correct code of selection sort it is bubble sort
@rahulprasad35753 жыл бұрын
selection sort code was different as it explained
@sampadsadhu43713 жыл бұрын
Yes I was confused at first
@yashchauhan72213 жыл бұрын
it is bubble sort which is shown in code not selection
@chiragkakwani31743 жыл бұрын
No 1 step has been missed
@ramakp343 жыл бұрын
@@yashchauhan7221 can u tell the code of selection sort
@yashchauhan72213 жыл бұрын
@@ramakp34 Ofcourse Dude #include using namespace std; int main() { int tot, arr[50], i, j, temp, small, chk, index; couttot; cout
@nikitasharma20693 жыл бұрын
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
@manthanpatil22682 жыл бұрын
Thanks btw!
@nikitagaikwad27882 жыл бұрын
Thx dear
@GULLAPUDILIKITHBCE2 жыл бұрын
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
@shaikwaseemahmed.55103 жыл бұрын
Thanks date to date videos thanks aman dattarwal and team
@anuragkumarsharma39262 жыл бұрын
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
@kashyapanuragi89872 жыл бұрын
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-nm4vn9tq5o2 жыл бұрын
Yes bro you are right, their code isn't working
@usmanaliansari52232 жыл бұрын
Code galat hai Selection sort ka
@i_mchick53113 жыл бұрын
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. ????? :)
@_AKASHNAIR2 жыл бұрын
its mostly an error in their script ,and its acceptable they were trying to maintain quality content while without comprmising on time
@meme-qw6hl2 жыл бұрын
Last chocolate wrapper+ 2 left wrapper =3wrappers=1chocolate
@meme-qw6hl2 жыл бұрын
#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
@_AKASHNAIR2 жыл бұрын
@@meme-qw6hl so in the end only 21 choclates and 2 wrappers will be left right?
@meme-qw6hl2 жыл бұрын
@@_AKASHNAIR no 22 chocolate and 0 wrapper
@vinayaktripathi2872 жыл бұрын
For all comments on the point that code looks like bubble sort. More like she used bubble sort to get the minimum value for selection sort. The only difference was the starting point of first for loop which decreased time complexity compared to bubble sort.
@shreyapanwar38002 жыл бұрын
I don't get it why are you using "n-1" in the first for loop{for(int i=0;i
@itshiraljain2 жыл бұрын
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]); } }
@harharmahadev10382 жыл бұрын
can you explain what you meant by saying that and this part... if (min != i) { swap(arr[min], arr[i]); }
@itshiraljain2 жыл бұрын
@@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...