Тёмный

Merge Sort - Data Structures & Algorithms Tutorial Python #17 

codebasics
Подписаться 1,1 млн
Просмотров 104 тыс.
50% 1

Опубликовано:

 

9 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 118   
@codebasics
@codebasics 2 года назад
Do you want to learn python from me with a lot of interactive quizzes, and exercises? Here is my project-based python learning course: codebasics.io/courses/python-for-beginner-and-intermediate-learners
@lokeshr808
@lokeshr808 2 года назад
Perfect way of teaching tech. I learnt a way better, fast and effective. Thank you sir.
@vircycure
@vircycure 3 года назад
I was watching merge sort code from different different blogs and different different youtubers but I haven't get anything. Today accidentally I watch this video. I understood everything. The way you teach is really awesome sir. Thank you from full of my heart 🖤
@shubhamh7451
@shubhamh7451 3 года назад
damn bruh same.
@quyenscc
@quyenscc 3 года назад
Same things happened to me. Lucky that I found this ^^
@mrigankchoudhary
@mrigankchoudhary 3 года назад
2 lectures left till i complete your full playlist, tysm i have been following your playlist since last month seeing it every day 1-2 hrs...it helped me learn dsa ...tysm...really it will always be a part of me in future..
@agasti2007
@agasti2007 4 месяца назад
Learning DSA is one thing, but what I admire most about you is your line of thinking - how you start simple and slowly build on to it. I personally start with every problem, thinking in all directions at the start, and run into analysis paralysis. The way you teach is much appreciated.
@harshutanku9650
@harshutanku9650 3 года назад
please make more on these algo's the most imp every cs student should know
@ceo_google
@ceo_google 3 года назад
thank you very much bhaiya !! Now after practicing this on my own ,I can say my merge sort is clear , and i can move to other topics
@codebasics
@codebasics 3 года назад
Glad it was helpful!
@latencey384
@latencey384 2 года назад
really good tutorial, definitely liked the different approach of starting with the merge function then moving in to the main recursive part.
@tesfatsionshiferaw3474
@tesfatsionshiferaw3474 3 года назад
I love your videos man! I will be contributing to your channel once I start earning!
@codebasics
@codebasics 3 года назад
Awesome! Thank you Tesfatsion!
@amranmohamed377
@amranmohamed377 2 года назад
@@codebasics Even me. Inshallah
@RadhamaniRamadoss
@RadhamaniRamadoss 2 года назад
I understood merge sort only after watching your video..Thankyou sir..
@iwuomasolomonuched518
@iwuomasolomonuched518 4 месяца назад
You're one of the Best. You deserve a hat trick of subscription if that was possible.
@shubhamh7451
@shubhamh7451 3 года назад
no one: codebasics: we are gon "short" the array. anyways, great video sir! understood!
@omo2042
@omo2042 3 года назад
I think a better approach would be to say: # If a reached the end of list a add the remainder of b to sorted_list, and vice n verca if i == len_a: sorted_list += b[j:] else: sorted_list += a[i:] This way you avoid running extra loops
@awsomeslayer1
@awsomeslayer1 3 года назад
True, I also did the same thing by using extend()
@nishchaysingh7601
@nishchaysingh7601 3 года назад
else part will print the a list again instead put an if statement for both
@krishnachaitanya1265
@krishnachaitanya1265 2 года назад
It will do same on backend. But yeah makes easy to write
@AmanKhan-yf4wd
@AmanKhan-yf4wd 2 года назад
what about ? def merge_two_array(l1,l2): return sorted(l1+l2)
@devinmcmillen7827
@devinmcmillen7827 2 года назад
This is a great video. It's a different perspective than what I've seen in other videos but it really works. I'd highly recommend this video for someone new or as a refresher. Fabulous
@RachitKapoor214
@RachitKapoor214 Год назад
This lecture series is the best learning I have had in Data Structures, thank you so much for sharing the information in such a simplified form and thank you for motivating every single time to perform the activities. Completing the activities gave me a great confidence in coding in Python. Thank you so much Dhaval Sir, this was very very helpful!
@tusharnautiyal8998
@tusharnautiyal8998 2 года назад
Best video ever i tried many video for understanding merge sort but this is the only one i was able to understand properly.
@entity5678
@entity5678 5 месяцев назад
very well explained sir with bottom-up approach..
@KayYesYouTuber
@KayYesYouTuber 9 месяцев назад
This is simply beautiful. You are very good teacher. Very lucid explanation. Thanks.
@nehakumar9889
@nehakumar9889 3 года назад
I skipped this algorithm a lot of times. Finally, I understood. From class 12 to MCA. That's how long it took me to understand this algorithm
@codebasics
@codebasics 3 года назад
I am happy this was helpful to you.
@timo8032
@timo8032 3 года назад
THIS IS THE BEST EXPLANATION OF THIS ALGORITHM BY FAR!!!!!!!
@Jack_X075
@Jack_X075 3 года назад
While doing the in memory merge sort, we cannot simply write, arr[k] = a[i] and similary arr[k] = b[j] we have to swap them as variables arr, a and b........all are pointing to the same list in memory. so if we do arr[k] = a[i], this will lead to a data loss as the original value at arr[k] will be overwritten. This became apparent when trying to attempt the exercise. I believe over looking this was intentional on part of the teacher.
@zack176
@zack176 11 месяцев назад
How do we swap them
@mohammadmohsinmohammedmohs9717
@mohammadmohsinmohammedmohs9717 3 года назад
sir please continue uploading videos. why did you stop at 19th video
@iwuomasolomonuched518
@iwuomasolomonuched518 4 месяца назад
You're a genius.
@ArunKumar-yb2jn
@ArunKumar-yb2jn 2 года назад
One of the good things is you share other resources (like Khan Academy). Other trainers like to keep good resources to themselves. Thank you!!
@ZinduZatism
@ZinduZatism 3 года назад
thank you man you have explained very well in detail much appreciate it and subscribed
@codebasics
@codebasics 3 года назад
I am happy this was helpful to you.
@user-in7fc3hg8e
@user-in7fc3hg8e Год назад
amazing teacher
@khanplayoffs
@khanplayoffs 2 года назад
I recommend that you start from search and sort algorithms first and then learn the data structure, it will help you in recognizing the functions
@harsh2014
@harsh2014 3 года назад
Helped me to understand, Thanks!
@codebasics
@codebasics 3 года назад
Glad it helped!
@tamilvanan342
@tamilvanan342 2 года назад
the best part is your exercises. Please keep up the great job and thanks
@codebasics
@codebasics 2 года назад
👍🙏🎊☺️
@zahid1909
@zahid1909 2 года назад
True, bruv! There’s no parallel of this step by step exercise with commentaries, and optimizing and refining process! Great job, boss!
@zack176
@zack176 11 месяцев назад
I just hope you show leave comments in the exercise i can't seem to understand the code
@ZhagaramTech
@ZhagaramTech 3 года назад
Awesome explanation..... Love it
@Hariom_143-
@Hariom_143- 2 года назад
Your Teaching is too good sir.. Thankyou for the course
@samuelkantor8242
@samuelkantor8242 3 года назад
Well done, so clear and helpful
@codebasics
@codebasics 3 года назад
Glad it was helpful!
@shweta7362
@shweta7362 3 года назад
Thank you :D this seems a lot more easier now🙌✨
@codebasics
@codebasics 3 года назад
Happy to help!
@wouterrijsdijk6043
@wouterrijsdijk6043 Год назад
Excellent explanation!
@paulascatarelli5348
@paulascatarelli5348 2 года назад
What a great teacher!
@codebasics
@codebasics 2 года назад
Glad you think so!
@Narriz
@Narriz 3 года назад
Excellent.
@codebasics
@codebasics 3 года назад
Glad it was helpful!
@kmnm9463
@kmnm9463 2 года назад
Hi Dhaval, Perfect example and clear code, once again from you. Have a query which I am trying to get clarified for sometime now. How do we use merge sort for array of odd number of elements.? I needed to have the code for the same. Please help! Krish
@kunalmahajan7334
@kunalmahajan7334 3 года назад
Thanks ,clean explanation
@Zydres_Impaler
@Zydres_Impaler Год назад
Thanks so much
@stevenzayas5527
@stevenzayas5527 2 года назад
I always laugh at the veiled threats for prematurely clicking on the Solution in the Exercise... XD
@BABA-oi2cl
@BABA-oi2cl 3 года назад
Thanks for this explanation, sorted all my problems ;)
@ritikajaiswal3824
@ritikajaiswal3824 2 года назад
Please make a video on different types of algorithm like DFS, BFS etc.
@shivam9aa9
@shivam9aa9 3 года назад
Dhaval bhai @codebasics, bs aap videos banaye bolke I have revived my long crushed dream to prepare for google, cas i always was afraid of DS and Algo topics. Ab aap padha rahe ho to nhi hai darr. I am starting again and I will not let it go this time. Bhai next destination -> aapke channel pe interview "how i cracked a product company interview". Wish me luck, long road ahead.
@codebasics
@codebasics 3 года назад
Kumar, you have my best wishes. And sure i will do an interview with you for that cracking interview for product based company. Wish you all the best my friend 😊👍
@Nick-uo2bi
@Nick-uo2bi 2 года назад
Instead of using while two times we can use sorted_list= sorted_list+a[i:]+b[j:]
@datascience3008
@datascience3008 2 года назад
Thanks!
@mohammadgholampoor2539
@mohammadgholampoor2539 2 года назад
Thank you ♥♥
@codebasics
@codebasics 2 года назад
You're welcome 😊
@senthilkumarradhakrishnan744
@senthilkumarradhakrishnan744 9 месяцев назад
I just want to know one thing, you just eliminated a new array just to save memory and other optimisations, but even left and right variable that we use are storing as many lists right?
@ranganathnarasappa4680
@ranganathnarasappa4680 3 года назад
Thanks for sharing this video...it is easy to understand....could you please make some videos on Recursive function?
@codebasics
@codebasics 3 года назад
sure will try
@ShrinivasJamvant
@ShrinivasJamvant Год назад
sir would you mind sharing the name of compiler you use for python programming.
@meralmaradia4774
@meralmaradia4774 2 года назад
Hello Sir, can you please create a video developing of project using only DSA ?
@raghavb1276
@raghavb1276 2 года назад
But why will the technique not work on unsorted arrays?
@VarunKumar-pz5si
@VarunKumar-pz5si 3 года назад
When you will announce the giveaway winners?
@codebasics
@codebasics 3 года назад
Already announces. You are one of the winners. 😊
@anirudhgoutam6401
@anirudhgoutam6401 3 года назад
merge_two_sorted_list function only performed on sorted list ??? I'm Right Na
@debojitmandal8670
@debojitmandal8670 3 года назад
Sir it's easier to sort list or int it's difficult tonsolve strings and dictionary so I have no clue how to even approach the exercise problem you have given
@user-cx8lg4cs9z
@user-cx8lg4cs9z 2 года назад
If __ name__ == '__main__': can anyone explain this line, why use this line? Thank u
@Guderian444
@Guderian444 3 года назад
I didnt get why at the end you add k ?? It worked without it ....
@reubydoobydoo1383
@reubydoobydoo1383 3 года назад
to improve space complexity
@paulascatarelli5348
@paulascatarelli5348 2 года назад
Instead of creating a new list (which takes memory), he creates another variable k to be able to concatenate the elements in the correct order; using the space of one of the already existing lists, is it clear?
@mohsinkhattak2840
@mohsinkhattak2840 2 года назад
hey just wondering when we are using the two while loops outside the main while loop. will it not simply append the remaining elements of either the list without comparing the remaining values?
@luvubangaram3139
@luvubangaram3139 2 года назад
no, not actually. because here i is incremented and after exiting the while loop that i value remains incremented. just print i value after while loop so that you can experience my logic.
@avishek84
@avishek84 3 года назад
Can you recommend some books with Data Structures with Python as well?
@anoopsinghbhakuni9132
@anoopsinghbhakuni9132 3 года назад
bro same problem hai mere saath, upar se codebasics sir, kaafi slow videos daal rahe hai, pata nahi playlist puti kab hogi
@codebasics
@codebasics 3 года назад
Bhai anoop, yaar me bahut hi busy hu.. weekend me mera movie watching ka time nikalake ye video bana raha hu. I understand you guys want to learn fast but trust me I am on it. there is few more videos left but I have covered most of the content. Did you finished all exercises from this playlist?
@kashmirilalchitkara6872
@kashmirilalchitkara6872 3 года назад
@@codebasics it's ok no slow at all. It is clear all doubt in this slow speed
@ALLINONETV1
@ALLINONETV1 3 года назад
@@codebasics waiting ...
@Ram-vg5fu
@Ram-vg5fu 3 года назад
@@codebasics still waiting sir :-)
@mohammadmohsinmohammedmohs9717
@mohammadmohsinmohammedmohs9717 3 года назад
Sir should we learn C/C++ to understand DSA, i know C language(1st year enginnering) but i know python very well. Should i follow this series??
@VivekTiwari03
@VivekTiwari03 3 года назад
You can do very well in DSA with Python itself.
@mohammadmohsinmohammedmohs9717
@mohammadmohsinmohammedmohs9717 3 года назад
@@VivekTiwari03 but people say you cannot implement many algorithms in python???
@VivekTiwari03
@VivekTiwari03 3 года назад
@@mohammadmohsinmohammedmohs9717 You can implement EVERY SINGLE algorithm that you can in C/C++ in Python as well. Python generally isn't suited only because its a slow language in itself, but other than that there are no cons of using Python.
@mohammadmohsinmohammedmohs9717
@mohammadmohsinmohammedmohs9717 3 года назад
@@VivekTiwari03 but in campus placement will they all specifically for c /c++??
@VivekTiwari03
@VivekTiwari03 3 года назад
@@mohammadmohsinmohammedmohs9717 I know man. But more and more companies are accepting Python these days.
@MuhammadFaizan-mi9yo
@MuhammadFaizan-mi9yo 3 года назад
Hello sir how are you? I Gotta a big trouble please help me i have formated my laptop accidentally and lost all my 500 gb data plzzzzz plzzzz tell me how can i recover my data after making new partition again.plzz replay me ASAP
@StyleReDesign
@StyleReDesign Год назад
woahhhhhhhhhhhhhhhhhhhh
@sagarhm2237
@sagarhm2237 3 года назад
Sir how to edit vedios like u I love ur Contnt and editing
@codebasics
@codebasics 3 года назад
I use camtasia studio for screen recording and editing
@sagarhm2237
@sagarhm2237 3 года назад
Thanks sir
@prasadshete781
@prasadshete781 2 года назад
4:53 😅😂😂
@amandwivedi2302
@amandwivedi2302 2 года назад
alag se while loop ki zaroorat hi nahi thi pahele me hi or karna tha and nahi
@vishaldubey3463
@vishaldubey3463 3 года назад
Sir aap RU-vid channels ko leke ek series Banane wale the apane dusare channel pe??
@codebasics
@codebasics 3 года назад
yes vishal... that will come up but not sure when. I am busy with deep learning and data structures series right now. once these are over I can work on other plans.
@Aryansingh-fk7hy
@Aryansingh-fk7hy 3 года назад
merge_sort method is not sorting in my case!!
@vatsalsharma5791
@vatsalsharma5791 3 года назад
Sir is this the last tutorial in this series?
@anoopsinghbhakuni9132
@anoopsinghbhakuni9132 3 года назад
pata nahi bhai ye series kab puri hogi, samajh nahi aa raha
@codebasics
@codebasics 3 года назад
nope. there are few more left but i have covered majority of the content so you can say it is coming to an end.
@anoopsinghbhakuni9132
@anoopsinghbhakuni9132 3 года назад
@@codebasics sir i have seen may videos on DS&A on youtube , but aapki sabse best hai, concepts kaafi acche se cover ho rahe hai. thank you so much.
@poojithakumaran4715
@poojithakumaran4715 3 года назад
@@codebasics but will you put algorithm as well apart from DS
@kashmirilalchitkara6872
@kashmirilalchitkara6872 3 года назад
Sir c++. python which is better in future in data structure data
@Khanarmaanrokz
@Khanarmaanrokz 3 года назад
didn't understood.
Далее
Starman🫡
00:18
Просмотров 15 млн
Merge Sort In Python Explained (With Example And Code)
13:35
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Merge Sort Theory | DSA
15:56
Просмотров 17 тыс.
Sorting Algorithms Explained Visually
9:01
Просмотров 533 тыс.
Fast Inverse Square Root - A Quake III Algorithm
20:08
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36