Merge Sort - Data Structures & Algorithms Tutorial Python #17

  Рет қаралды 108,607

codebasics

codebasics

Күн бұрын

Пікірлер: 119
@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 4 жыл бұрын
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 4 жыл бұрын
damn bruh same.
@quyenscc
@quyenscc 3 жыл бұрын
Same things happened to me. Lucky that I found this ^^
@agasti2007
@agasti2007 7 ай бұрын
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.
@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..
@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.
@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.
@harshutanku9650
@harshutanku9650 3 жыл бұрын
please make more on these algo's the most imp every cs student should know
@RadhamaniRamadoss
@RadhamaniRamadoss 2 жыл бұрын
I understood merge sort only after watching your video..Thankyou sir..
@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
@KayYesYouTuber
@KayYesYouTuber 11 ай бұрын
This is simply beautiful. You are very good teacher. Very lucid explanation. Thanks.
@ArunKumar-yb2jn
@ArunKumar-yb2jn 3 жыл бұрын
One of the good things is you share other resources (like Khan Academy). Other trainers like to keep good resources to themselves. Thank you!!
@iwuomasolomonuched518
@iwuomasolomonuched518 7 ай бұрын
You're one of the Best. You deserve a hat trick of subscription if that was possible.
@timo8032
@timo8032 3 жыл бұрын
THIS IS THE BEST EXPLANATION OF THIS ALGORITHM BY FAR!!!!!!!
@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.
@tesfatsionshiferaw3474
@tesfatsionshiferaw3474 4 жыл бұрын
I love your videos man! I will be contributing to your channel once I start earning!
@codebasics
@codebasics 4 жыл бұрын
Awesome! Thank you Tesfatsion!
@amranmohamed377
@amranmohamed377 2 жыл бұрын
@@codebasics Even me. Inshallah
@shubhamh7451
@shubhamh7451 4 жыл бұрын
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 3 жыл бұрын
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)
@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 Жыл бұрын
How do we swap them
@entity5678
@entity5678 8 ай бұрын
very well explained sir with bottom-up approach..
@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
@mohammadmohsinmohammedmohs9717
@mohammadmohsinmohammedmohs9717 4 жыл бұрын
sir please continue uploading videos. why did you stop at 19th video
@tamilvanan342
@tamilvanan342 3 жыл бұрын
the best part is your exercises. Please keep up the great job and thanks
@codebasics
@codebasics 3 жыл бұрын
👍🙏🎊☺️
@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 Жыл бұрын
I just hope you show leave comments in the exercise i can't seem to understand the code
@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.
@Hariom_143-
@Hariom_143- 2 жыл бұрын
Your Teaching is too good sir.. Thankyou for the course
@iwuomasolomonuched518
@iwuomasolomonuched518 7 ай бұрын
You're a genius.
@paulascatarelli5348
@paulascatarelli5348 2 жыл бұрын
What a great teacher!
@codebasics
@codebasics 2 жыл бұрын
Glad you think so!
@SyaerulRochman
@SyaerulRochman Жыл бұрын
amazing teacher
@harsh2014
@harsh2014 3 жыл бұрын
Helped me to understand, Thanks!
@codebasics
@codebasics 3 жыл бұрын
Glad it helped!
@wouterrijsdijk6043
@wouterrijsdijk6043 Жыл бұрын
Excellent explanation!
@ZhagaramTech
@ZhagaramTech 3 жыл бұрын
Awesome explanation..... Love it
@samuelkantor8242
@samuelkantor8242 4 жыл бұрын
Well done, so clear and helpful
@codebasics
@codebasics 4 жыл бұрын
Glad it was helpful!
@shweta7362
@shweta7362 3 жыл бұрын
Thank you :D this seems a lot more easier now🙌✨
@codebasics
@codebasics 3 жыл бұрын
Happy to help!
@shivam9aa9
@shivam9aa9 4 жыл бұрын
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 4 жыл бұрын
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 😊👍
@BABA-oi2cl
@BABA-oi2cl 3 жыл бұрын
Thanks for this explanation, sorted all my problems ;)
@stevenzayas5527
@stevenzayas5527 2 жыл бұрын
I always laugh at the veiled threats for prematurely clicking on the Solution in the Exercise... XD
@Narriz
@Narriz 3 жыл бұрын
Excellent.
@codebasics
@codebasics 3 жыл бұрын
Glad it was helpful!
@kunalmahajan7334
@kunalmahajan7334 3 жыл бұрын
Thanks ,clean explanation
@ritikajaiswal3824
@ritikajaiswal3824 2 жыл бұрын
Please make a video on different types of algorithm like DFS, BFS etc.
@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
@Nick-uo2bi
@Nick-uo2bi 2 жыл бұрын
Instead of using while two times we can use sorted_list= sorted_list+a[i:]+b[j:]
@Zydres_Impaler
@Zydres_Impaler Жыл бұрын
Thanks so much
@datascience3008
@datascience3008 2 жыл бұрын
Thanks!
@mohammadgholampoor2539
@mohammadgholampoor2539 2 жыл бұрын
Thank you ♥♥
@codebasics
@codebasics 2 жыл бұрын
You're welcome 😊
@senthilkumarradhakrishnan744
@senthilkumarradhakrishnan744 Жыл бұрын
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 4 жыл бұрын
Thanks for sharing this video...it is easy to understand....could you please make some videos on Recursive function?
@codebasics
@codebasics 4 жыл бұрын
sure will try
@VarunKumar-pz5si
@VarunKumar-pz5si 4 жыл бұрын
When you will announce the giveaway winners?
@codebasics
@codebasics 4 жыл бұрын
Already announces. You are one of the winners. 😊
@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?
@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
@anirudhgoutam6401
@anirudhgoutam6401 3 жыл бұрын
merge_two_sorted_list function only performed on sorted list ??? I'm Right Na
@avishek84
@avishek84 4 жыл бұрын
Can you recommend some books with Data Structures with Python as well?
@anoopsinghbhakuni9132
@anoopsinghbhakuni9132 4 жыл бұрын
bro same problem hai mere saath, upar se codebasics sir, kaafi slow videos daal rahe hai, pata nahi playlist puti kab hogi
@codebasics
@codebasics 4 жыл бұрын
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 4 жыл бұрын
@@codebasics it's ok no slow at all. It is clear all doubt in this slow speed
@ALLINONETV1
@ALLINONETV1 4 жыл бұрын
@@codebasics waiting ...
@Ram-vg5fu
@Ram-vg5fu 3 жыл бұрын
@@codebasics still waiting sir :-)
@mohammadmohsinmohammedmohs9717
@mohammadmohsinmohammedmohs9717 4 жыл бұрын
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 4 жыл бұрын
You can do very well in DSA with Python itself.
@mohammadmohsinmohammedmohs9717
@mohammadmohsinmohammedmohs9717 4 жыл бұрын
@@VivekTiwari03 but people say you cannot implement many algorithms in python???
@VivekTiwari03
@VivekTiwari03 4 жыл бұрын
@@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 4 жыл бұрын
@@VivekTiwari03 but in campus placement will they all specifically for c /c++??
@VivekTiwari03
@VivekTiwari03 4 жыл бұрын
@@mohammadmohsinmohammedmohs9717 I know man. But more and more companies are accepting Python these days.
@MuhammadFaizan-mi9yo
@MuhammadFaizan-mi9yo 4 жыл бұрын
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
@vishaldubey3463
@vishaldubey3463 4 жыл бұрын
Sir aap KZbin channels ko leke ek series Banane wale the apane dusare channel pe??
@codebasics
@codebasics 4 жыл бұрын
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.
@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.
@ShrinivasJamvant
@ShrinivasJamvant 2 жыл бұрын
sir would you mind sharing the name of compiler you use for python programming.
@anotheryoutuberperson38
@anotheryoutuberperson38 Ай бұрын
He used PyCharm. He said this in the video.
@F999-t7o
@F999-t7o 2 жыл бұрын
If __ name__ == '__main__': can anyone explain this line, why use this line? Thank u
@sagarhm2237
@sagarhm2237 4 жыл бұрын
Sir how to edit vedios like u I love ur Contnt and editing
@codebasics
@codebasics 4 жыл бұрын
I use camtasia studio for screen recording and editing
@sagarhm2237
@sagarhm2237 4 жыл бұрын
Thanks sir
@vatsalsharma5791
@vatsalsharma5791 4 жыл бұрын
Sir is this the last tutorial in this series?
@anoopsinghbhakuni9132
@anoopsinghbhakuni9132 4 жыл бұрын
pata nahi bhai ye series kab puri hogi, samajh nahi aa raha
@codebasics
@codebasics 4 жыл бұрын
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 4 жыл бұрын
@@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 4 жыл бұрын
@@codebasics but will you put algorithm as well apart from DS
@StyleReDesign
@StyleReDesign Жыл бұрын
woahhhhhhhhhhhhhhhhhhhh
@amandwivedi2302
@amandwivedi2302 2 жыл бұрын
alag se while loop ki zaroorat hi nahi thi pahele me hi or karna tha and nahi
@Aryansingh-fk7hy
@Aryansingh-fk7hy 3 жыл бұрын
merge_sort method is not sorting in my case!!
@prasadshete781
@prasadshete781 2 жыл бұрын
4:53 😅😂😂
@Khanarmaanrokz
@Khanarmaanrokz 4 жыл бұрын
didn't understood.
@kashmirilalchitkara6872
@kashmirilalchitkara6872 4 жыл бұрын
Sir c++. python which is better in future in data structure data
Shell Sort - Data Structures & Algorithms Tutorial Python #18
18:33
Merge Sort In Python Explained (With Example And Code)
13:35
FelixTechTips
Рет қаралды 226 М.
Do you love Blackpink?🖤🩷
00:23
Karina
Рет қаралды 22 МЛН
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2,1 МЛН
Merge Sort Theory | DSA
15:56
Telusko
Рет қаралды 22 М.
Bubble Sort - Data Structures & Algorithms Tutorial Python #14
15:09
3 Types of Algorithms Every Programmer Needs to Know
13:12
ForrestKnight
Рет қаралды 501 М.
Learn Merge Sort in 13 minutes 🔪
13:45
Bro Code
Рет қаралды 344 М.
All Machine Learning algorithms explained in 17 min
16:30
Infinite Codes
Рет қаралды 382 М.
Quick Sort - Data Structures & Algorithms Tutorial Python #15
31:17
Full Computer Science Degree in a Nutshell
20:39
MrAlgorithm
Рет қаралды 80 М.