literally i was impressed by her first few videos and then searched her on youtube but sadly didn't found anything related to her. i wish she would also have channel so we can subscribe her and support her. 😊
really felt gratitude didi, thank you for providing such a video for free. It contains the whole 2hrs of class lecture content incorporated in just few minutes, AMAZING.
Didi from this video i just watched the concept behind bubble sort and the code i printed on my own. The output was correct and I am very happy as I am a beginner and have printed the code very easily. Thx for your lectures.
Bubble sort complexity - Time complexity - 1. Best case - O(n) ( if array is already sorted ) 2. Average case - O(n^2) 3. Worst case - O(n^2) Space complexity - O(the number of extra variables used) if 1 extra variable then O(1) , if 2 extra variable then O(2).
before apna college ,i was dumb in coding,concept of coding went to upper side from my head,One day i meet to my brother,He suggested me to see coding on apna college,,and then after this,, now I can say that i can do something in coding.Love U all apna college team,,One day I shall meet to apna college team sure,specially Shradhha di.
You can also do this simply with the help of a for loop like this for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - i; j++) { if (arr[j + 1] < arr[j]) { temp = arr[j + 1]; arr[j + 1] = arr[j]; arr[j] = temp; } } }
It is not just because we will have to do one less iteration , in the code we are comparing the (i th) and (i+1 th) terms. So we keep the counter < n-1 so that when we are checking for the (i+1 th) term we do not get *INDEX OUT OF BOUND ERROR*
We don’t need to run n times this algorithm If we don’t find any swapping. It’s like break when no bubbles happens. As per video... Current Time complexity : O(N*N) But it can give O(N) in best case eg. already sorted array. Just check by boolean that if no bubble produce ( no swapping occurs ) break loop. 👌
I agree with you that it will give O(n) time complexity in best case. But that's not our concern. We have to find some algorithm so that the worst case time complexity gets minimized ,which according to me, can't be lesser than O(n^2) in the bubble sort method. If there's a way to decrease the worst case complexity here please share. 🙏
beach mai ak din ka gaap ho gya tha,yesterday their was no new video, or meri to tention start hone laga tha, and that's why egarly waiting for todays video.
Yup you are right my brother but no matter if it takes one more iteration because array is already sorted. Yes it will take little more time. And this is not a good practice to make this mistake because you know this that it will take only "n-1" iteration to sort the array Hope you got your answer 👍👍👍😀😀😃
no bro. there is no mistake as counter is starting from 1 and not from 0. Otherwise you would be correct. since it is starting from 1, loop repeats (n-1) times only.
Thanks a lot, ye bubble sort confuse kar diya tha teachers ne....ab jaake iska concept dhang se samajh aaya hai, final year mai hu abhi ......this series gives me hope that even I can learn these concepts properly.
nah ...then u would have to create the whole funtion for swap() seperately >....thus same amount of work...Use funtion only when u need to repeatedly use it
@@harshkantbhatnagar360 We can also use this function using iostream header file see this code #include using namespace std; int main(){ int a,b; cin>>a>>b; cout
instead of the while loop we can also do this : for(i=count-2;i>=0;i--){ for(j=0;jnumber[j+1]){ temp=number[j]; number[j]=number[j+1]; number[j+1]=temp;
Thank you so much. You made these concepts so easy for me that looked difficult previously for me. Now, I taught these to my fellow classmates even before they knew.
Name was corrected, but *also correct the description box from 9.3.1 to 8.3.1 !* This is Aman Bhaiya, 😉 No Chance of Mistakes. Even when once there was a error in animation in Maths, he corrected it in the comments !!!
The great teaching method, Thanks for serving us these videos, and I have a suggestion please make basic projects and shout them as lessons. thank you so much for this kind of teaching,
There is a mistake in this code ,the last input no is not get check or swap. Int counter is starting form 1 and if the input is (54321 it will give 23451 ) it is not checking the last element. Plz check this . Y the counter is not staring from 0.
i have done c++ the much it is needed for dsa. you explain the dry run thing very well but when it comes to code there are many things i am not understanding.
Bhaiya apni kaksha mai pls thoda jaldi jaldi video daalo kyuki humare per board hai agle mahine se hum of wale hai bhaiya aur kv mai pre board pahele hota hai... Mujhe pata hai app bahut mahenat kar rahe ho aur animation mai time bhi lagta hai lekin fir bhi bhaiya thoda jaldi🙏🙏🙏
We can also use this method, it will be in the same structure as Selection Sort #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
@@hisokamorrow7976 I don't think so, for i=0 ,j should run from 0 to 3 only ,on fourth iteration(for j=3) you will get largest element at the end of array ,plz check
Hello team, Please try to mention complexity analysis for each necessary videos and if possible please inculde the puzzles similar to later videos Overall learning experience is too good and simple and best. Thank you.
Hi di I didn't understand one thing in the video. At 3:40 you said that for n elements in the array, we have to do (n-1) iterations. But does the number of iterations not vary from example to example ? Like for your example you get the sorted array in 5 iterations but if you take something like {45,2,31,27,8,36} It takes only 3 iterations though there are 6 elements. Pls clarify anyone
the loop will continue as long as this condition is true -> while(count < n). when count is 1, we do the first iteration and the array becomes {2,31,27,8,36,45} and after this the count becomes count++ that is count = 2. similarly by the time count becomes 3 our array is already sorted {2,8,27,31,36,45}. cool? ab hamara loop jabtak while(count < n) wala condition false nai hojata ye chalta rahega. so now after 3rd loop our count will become 4 and this time it will simply ignore the if condition cause ar[i] is no longer less than ar[i+1] and our count becomes 5 now. so we go into our for loop again and ignore the if condition once more, then we get out of our for loop and this time our count becomes 6! which goes against while(count < n) because n is the size of array which in your case is 6. and 6 is not less than 6. and then we exit the entire loop and our array is sorted.
I think the whole algo is correct but instead of creating temp variable for swapping we can like use function swap( arr [ i+1], arr[i] ) this will reduce time and logic is simple too ! what say !
Bubble sort -
Time complexity is O(n^2) , and in best case it is O(n), if the array is already sorted.
Thank you.
If the array is already sorted, why would you sort? It would be just an iteration over the array so yeah order of n is obv
Big O notation is for worst case. Hence O(n^2).
For best case, it's big Omega notation
Hence Ω(n).
Urvi didi teaches soooooo well she is the best 🥰🥰
Trust me she's gonna best instructor , teacher and mentor 🙏🔥💖
Her voice 💘
literally i was impressed by her first few videos and then searched her on youtube but sadly didn't found anything related to her. i wish she would also have channel so we can subscribe her and support her. 😊
The one who wrote the script might be crying in the corner 😂
She is best but don't leave Mysirg samjhe bachye😁😁😁😁
one of the*
really felt gratitude didi, thank you for providing such a video for free. It contains the whole 2hrs of class lecture content incorporated in just few minutes, AMAZING.
Notes -
Bubble Sort - Concept - [0:10]
Bubble Sort - Code - [4:40]
pdhai krle bhai
@@shubhsYT 🙏
@@shreyaschavhan5522 thanks bhai
Didi from this video i just watched the concept behind bubble sort and the code i printed on my own. The output was correct and I am very happy as I am a beginner and have printed the code very easily. Thx for your lectures.
Ma'am your voice is so listenable. Great explanation. Thank u so much
Bubble sort complexity -
Time complexity -
1. Best case - O(n) ( if array is already sorted )
2. Average case - O(n^2)
3. Worst case - O(n^2)
Space complexity - O(the number of extra variables used) if 1 extra variable then O(1) , if 2 extra variable then O(2).
In case, if you are stuck
Use this:
int counter=0;
while(counter
Isme h na 100 0 2 29 le rha hun to 2 0 29 100 output de rha h
Aman bhaiya is doing good for all of us and we should be thankful to him
This channel deserves 1 million subscriber.
Oh my God
I was so worried about Data structure
Then i saw your Video
It is very Useful
Keep up the good work
In this video the counter should be intialise to 0 not 1
And in the for loop I
before apna college ,i was dumb in coding,concept of coding went to upper side from my head,One day i meet to my brother,He suggested me to see coding on apna college,,and then after this,, now I can say that i can do something in coding.Love U all apna college team,,One day I shall meet to apna college team sure,specially Shradhha di.
In while loop, its while(counter
yes you are right
Thanks sir for this series , this help me more for my placement preparation
@@SahilSharma-vl9rk bro it's less than n
@@negasonicteenagewarhead what do you mean?
@@negasonicteenagewarhead
you have n o t said anything exactly "in a clear way".
soou.. wht's da point of commenting “
@@rajlaxmipaul21 The person I replied to has deleted his comment
@@negasonicteenagewarhead oou i didn't understand dat
I'm of class 11th following your every video .......from Andhra pradesh
You can also do this simply with the help of a for loop like this
for (int i = 0; i < n - 1; i++)
{
for (int j = 0; j < n - i; j++)
{
if (arr[j + 1] < arr[j])
{
temp = arr[j + 1];
arr[j + 1] = arr[j];
arr[j] = temp;
}
}
}
you can also take initial value of i=1;for faster code
the inner loop would be:
for(int j = 0; j < n - i - 1; j++)
you may cross-check to see 😊
Mention complexity for each algorithm at the end of algorithm
O(n²) sabka yahi hoga
well its (counter
It is not just because we will have to do one less iteration , in the code we are comparing the (i th) and (i+1 th) terms. So we keep the counter < n-1 so that when we are checking for the (i+1 th) term we do not get *INDEX OUT OF BOUND ERROR*
@@gauravjain1444 ya i know that but it should be counter
@@shaleenbadola4514 counter
@@gauravjain1444 i agree with counter not should be initialized with 0 but in video di said counter
@@shaleenbadola4514 see the video once again they edited the -1 part out 😅 .she says n-1 but in the code she writes n
I was able to code the bubble sort algorithm just by the explanation part of this video. Thank you very much !!
We don’t need to run n times this algorithm If we don’t find any swapping. It’s like break when no bubbles happens.
As per video...
Current Time complexity : O(N*N)
But it can give O(N) in best case eg. already sorted array. Just check by boolean that if no bubble produce ( no swapping occurs ) break loop. 👌
I agree with you that it will give O(n) time complexity in best case. But that's not our concern. We have to find some algorithm so that the worst case time complexity gets minimized ,which according to me, can't be lesser than O(n^2) in the bubble sort method. If there's a way to decrease the worst case complexity here please share. 🙏
Great.....
You are right bro, this is updated bubble sort that you are talking about. 👍👍
Aap sab log kaafi padhe likhe lag rahe ho, aap logo ki job lag gayi h kya yeh videos dekhne k baad ?
@@anakingaming3687 pahle hi lag chuki hai job bhai.. Pr aise q bol rhe ho?
beach mai ak din ka gaap ho gya tha,yesterday their was no new video, or meri to tention start hone laga tha, and that's why egarly waiting for todays video.
Mai commerce student hu phir v i feel the same 😑
same here
Best way for learning apna college by shraddha didi❤
[CORRECTION]
In the while statement of the program, (counter
Yup you are right my brother but no matter if it takes one more iteration because array is already sorted. Yes it will take little more time. And this is not a good practice to make this mistake because you know this that it will take only "n-1" iteration to sort the array
Hope you got your answer 👍👍👍😀😀😃
no bro. there is no mistake as counter is starting from 1 and not from 0. Otherwise you would be correct.
since it is starting from 1, loop repeats (n-1) times only.
I need help plz!
As we know there are (n-1) iterations
So why we take (counter
@@vipulbhardwaj8659 it is for u
Instade of using *whileloop* and *counter* u can use this
for(int j=0;j
Instade of using *whileloop* and *counter* u can use this
for(int j=0;j
Very easy to understand it now rather than boring lecture in class
Thanks a lot, ye bubble sort confuse kar diya tha teachers ne....ab jaake iska concept dhang se samajh aaya hai, final year mai hu abhi ......this series gives me hope that even I can learn these concepts properly.
5:25 didi ham ek swap() function ka bhi to use kar sakte hai bas swap(arr[i], arr[i+1]); ek line me ho jata 3 lines ke jagah
nah ...then u would have to create the whole funtion for swap() seperately >....thus same amount of work...Use funtion only when u need to repeatedly use it
@@ashwinpillai9291 no in the bits/stdc++.h header file it's already present
we can use that in place of iostream
@@harshkantbhatnagar360 We can also use this function using iostream header file see this code
#include
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout
@@namitgarg3364 okay bro
@@harshkantbhatnagar360 No problem bro
instead of the while loop we can also do this :
for(i=count-2;i>=0;i--){
for(j=0;jnumber[j+1]){
temp=number[j];
number[j]=number[j+1];
number[j+1]=temp;
Awesome mam after trying to visualise continue 8 hr then i come to video and in shot i got it all points thanku mam
Bilkul Sare doubts clear ho gaye mere..
Thank u aman bhaiya and mam best explanation ever watched 😍🖤❤❤❤
Thank you so much AMAN BHAIYA and the whole team of APNA COLLEGE ❤️❤️✨✨
Consistency = Aman Bhaiya
And we all of us also be in a consistent manner always💥🙋🏻♂️
Wow!.....short, crisp and to-the-point..
It's very fast and effective method to solve bubble sort as how to works and implement in program
It took my clg sooo many hours to explain this and still kuch samjh nhi aaya.. But thanku didi and aman bhaiya for such amazing content.. Thankyou❤❤
*NOTE*- COUNTER MUST BE INITIALIZED WITH 0 INSTEAD OF 1, as she explains... But taken 1 mistakenly.... #CHLO PHODTE HYY ✨⚡😎
imma using this explanation for python class 12
thankyou di and bhaiya
Nice work by didi and aman bhaiya
Thank you so much. You made these concepts so easy for me that looked difficult previously for me. Now, I taught these to my fellow classmates even before they knew.
A tiny mistake at 4:59 where u said counter
Instade of using *whileloop* and *counter* u can use this
for(int j=0;j
Counter < n hoga in while condition. I think.
Ma'am ke code mei bhi -1 type nahi hua (maybe due to some error)
yes n-1 nahi n yoga
well i prefer this code.
//Sorting is done here
for(int i=0; i
thank you so much
I'm very dumb in computer science but the way she explained really helped me
BEST Bubble Sort VDO ever...❤
in while loop counter is not less than n-1 its while( counter < n )
either it is
ek to awaaz itni pyaari hai upar se padhati bhi world class hain
Everyone do like man, They are providing Platinum for free.
I recommend this video. I am very happy and grateful.
This is awesome! Very concise and informative😍
Name was corrected, but *also correct the description box from 9.3.1 to 8.3.1 !* This is Aman Bhaiya, 😉 No Chance of Mistakes.
Even when once there was a error in animation in Maths, he corrected it in the comments !!!
best explanation on this topic, the visuals were extraordinarily effective
Best Explanation I ever had.😊
Thank u aman bhaia mam i m loving your explanation ❤ 😍
Didi bahut achha hai thanks
in place of while loop , if we use for loop , have same time complexity , but space complexity may be improved.
Below is the bubble sort that i have done based on her explaination.....any comments on its time complexity.
for(int i=0; i
Hi everyone what's up....at 0:01👌👌👌
just want to notify that there is an error in notes ... in the for loop statement of bubble sort ...n-counter will be there instead of n-counter-1 :)
its correct , the code written in video is wrong.
the code in video and in notes both are correct
look in the video counter=1 and in notes counter=0
@@lakshyajoshi5413 but code is not working it's showing exit with code status 0
Dear sister your awesome I like your teaching 🥰
The great teaching method, Thanks for serving us these videos, and I have a suggestion please make basic projects and shout them as lessons.
thank you so much for this kind of teaching,
There is a mistake in this code ,the last input no is not get check or swap.
Int counter is starting form 1 and if the input is
(54321 it will give 23451 ) it is not checking the last element.
Plz check this .
Y the counter is not staring from 0.
Very well explained Shradha didi
YOU ARE doing very good job ,best teacher!!
Everyone is a legend until aman bhaiya walks in😎😎😎
Thank you clear all doubts
superb explanation👌👌
web development kab aayega..
Khud seek
Aa jayega aur news chaiye toh unke main channel ja
@@vickys40 😂😂
Try The Net Ninja's tutorial on his channel. Will give you a big headstart until Apni Kaksha's course comes.
@@itsmepiyushsaha Yea you are right
i have done c++ the much it is needed for dsa. you explain the dry run thing very well but when it comes to code there are many things i am not understanding.
dislikers are Chintu's ghar vaale who paid 100k plus rs to white hate 😂
Awesome explanation 👌👍
Very nicely explained 👍
Awesome explaining in just 7 min.
Bhaiya apni kaksha mai pls thoda jaldi jaldi video daalo kyuki humare per board hai agle mahine se hum of wale hai bhaiya aur kv mai pre board pahele hota hai...
Mujhe pata hai app bahut mahenat kar rahe ho aur animation mai time bhi lagta hai lekin fir bhi bhaiya thoda jaldi🙏🙏🙏
very informative good video💓
East or West Urvi Di is the best
how did you get to know her name ?
Wo jab Apne code ko run Karti hai ...toh waha pe unka Naam show hota hai
Her name is shardha
Thank you for explaning bubble sort in concise way easily🙂
We can also use this method, it will be in the same structure as Selection Sort
#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
You just increased the time of the compilation without any reason.. 🥴
apart from using 'while + for' loop, one can also use double-for loops:
for(int i=0;i
i think j's loops should be from 0 to n - i - 1?
@@mansha6566 I dont think so, for i=0 it's supposed to run till 5(4th index) and for i=1 till 5-1=4(3rd index)
@@hisokamorrow7976 I don't think so, for i=0 ,j should run from 0 to 3 only ,on fourth iteration(for j=3) you will get largest element at the end of array ,plz check
@@mansha6566 Ah! I got what you're saying thank you for correcting, I mistook this comment as the one on search video. Thanks
@@hisokamorrow7976 ☺️🤘
I don't think anyone can explain the bubble concept so easily than how our Didi teaches us 😍❤️
*** The condition inside while loop should be counter
no bro u are wrong
if the condition inside while loop is counter < n-1 then it actually means n-2
because the relational operator is "
@@sourabhsingh5941 he is correct bro my code won't run on that condition given in lecture
Bhaiya , please make a video on IP university order of choice filling 🙏🙏
What a short🔥🔥😍
Complete code ek saath dikh jata to shi rhta😊
baaki video jbrdsttt hai 👌👌💥💥💥
I love the 15 chocolate example
Nice explained and easy to understand ☺️
Thank you so much mam👍
Hello team, Please try to mention complexity analysis for each necessary videos and if possible please inculde the puzzles similar to later videos
Overall learning experience is too good and simple and best.
Thank you.
thank you very much yrr it really helps ......and the music is also motivating....
Time complexity:O(N^2)
Hi di
I didn't understand one thing in the video. At 3:40 you said that for n elements in the array, we have to do (n-1) iterations.
But does the number of iterations not vary from example to example ?
Like for your example you get the sorted array in 5 iterations but if you take something like {45,2,31,27,8,36} It takes only 3 iterations though there are 6 elements. Pls clarify anyone
the loop will continue as long as this condition is true -> while(count < n). when count is 1, we do the first iteration and the array becomes {2,31,27,8,36,45} and after this the count becomes count++ that is count = 2. similarly by the time count becomes 3 our array is already sorted {2,8,27,31,36,45}. cool? ab hamara loop jabtak while(count < n) wala condition false nai hojata ye chalta rahega. so now after 3rd loop our count will become 4 and this time it will simply ignore the if condition cause ar[i] is no longer less than ar[i+1] and our count becomes 5 now. so we go into our for loop again and ignore the if condition once more, then we get out of our for loop and this time our count becomes 6! which goes against while(count < n) because n is the size of array which in your case is 6. and 6 is not less than 6. and then we exit the entire loop and our array is sorted.
@@benmyths thankyou so much man you just cleared the confusion
DIDI your voice is so attractive and I like your intro as well as your content is fantastic more help to me preparation for placement
nice explaination mam.....
loved your unique method of teaching programming.....its becoming so easy for me 😍😍😍😍😍😍😍😍😍😍😍😍😄😄😄😄😄😄😄😄🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰
Amazing lecture 👍
@@SahilSharma-vl9rk editing mistake
@@SahilSharma-vl9rk n-1 in index but for size it will be run
@@SahilSharma-vl9rk bhai mereko nahi pata hai i m a class 12th student..... i think it might be editing mistake
@@aditshah2662 bhai explanation me n-1 times tq loop chalane ki baat ki gai hai na ki n-1 index tq....
Kuch bhi galat nahi hai.....
@@novaprime8735 ok
Wow🤟🔥🔥🔥.. Excellent
I think the whole algo is correct but instead of creating temp variable for swapping we can like use function swap( arr [ i+1], arr[i] )
this will reduce time and logic is simple too !
what say !
explained so perfectly i am going to complete this series asap once I am done with my exam
me too
Apti or DBMS ke liye bhi bana d0 bhaiiyyaa🥺🥺
Support Aman bhaiya he's doing great job for us
sir really thanx a lot you all are doing nice job
Instead of using 'while' loop, can we use 'for' loop as for(int i = 1; i < n; i++) ?
yes