Sort an array of 0s, 1s and 2s | Arrays | Love Babbar DSA Sheet | Hindi

preview_player
Показать описание


Please like, share and subscribe if you found the video useful. Feel free to ask in comments section if you have any doubts. :)

#DataStructuresAndAlgorithms
#LoveBabbarDSASheet
#interviewpreparation
Sort an array of 0s, 1s and 2s solution
Sort an array of 0s, 1s and 2s Leetcode
Sort an array of 0s, 1s and 2s C++
Sort an array of 0s, 1s and 2s C++ Hindi
Sort an array of 0s, 1s and 2s Hindi
Sort colors C++
Sort colors Java
Sort colors Python

Checkout the series: 🔥🔥🔥

LIKE | SHARE | SUBSCRIBE 🔥🔥😊
Рекомендации по теме
Комментарии
Автор

class Solution
{
public static void sort012(int a[], int n)
{
int l = 0;
int m = 0;
int h = n - 1;
int temp = 0;

while (m <= h)
{
if (a[m] == 0)
{
temp = a[m];
a[m] = a[l];
a[l] = temp;
l++;
m++;
}
else if (a[m] == 1)
{
m++;
}
else
{
temp = a[m];
a[m] = a[h];
a[h] = temp;
h--;
}
}
}
} java code

sreejaakella
Автор

your explanation skills are just wow!! :)

anushkaa__chauhan
Автор

thank you very much. I'm a mechanical engineering pass out and learning DS algo this is very handy for me.

Shivam-brbk
Автор

while(m<h)
I got no correct answer but when i use m<=h i got right answer. Thanks a lot

balkishan
Автор

Nice explain Ayushi
Thank
Explain method is awesome

suraj_patwa
Автор

Excellent explanation. Understood this in one go.

parasjain
Автор

nice solution with very natural explanation. 😀

RajeshS-nj
Автор

very well explained
i will see all ur 450 videos, best of luck, keep it up

SonuKumar-uqrb
Автор

Explain the logic very well keep it up!!!

amitchaudhary
Автор

Great great explaination. Keep on doing the great work... ❤️❤️

arnabroy
Автор

Ayushi didi 4:04 me O(n squar) hoga na kyon ki ek traversal me 0, 1, 2 ko check kar rahahe or ek traversal me new array ko update karne ka liya lagaraha ha?

sibashisnayak
Автор

your explanation are Nice...Thanks a lot

gunjanchoudhary
Автор

What an explanation. A mind blowing explanation sister!! Well done 👍

Delightfscreator
Автор

Please Keep making such videos. Thanks :)

DecentProgrammer
Автор

Make a video onnhow did you prepare for wallmart

vikeshdas
Автор

M is increment when the condition is fails....then what is the m value? Here two times ar[m] ==1. So m is incremented. Then after that m value becomes 2. Then ar[m] means ar[2]. Is it right? I have full confused here about m index ..😢

ourcreations
Автор

Aap bhi apni DSA sheet launch kariye.Nice video didi

imshivendra
Автор

Mam thoda motivation le v video bana doh plz required a lot btw video is superb❤️

bipinsingh
Автор

why did you take m<=h and not m<h

ujjwalsagar
Автор

I think count0, count1, count2 varaible wale approach me space complexity o(1) hi hai ?? video mai o(n) bola hai

ShivamKendre-fcsu