Understanding Sorting Techniques in an hour | Keerti Purswani | Geeks Summer Carnival

GeeksforGeeks · Beginner ·⚡ Algorithms & Data Structures ·4y ago

Key Takeaways

Understanding Sorting Techniques, including Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, and Quick Sort, with explanations and examples.

Full Transcript

[Music] foreign [Music] [Music] so hello everyone welcome back to geeksforgeeks my name is muskana garwal and i am here with yet another webinar so before i add my guest to the stream i would like you all to confirm me in the comment section if i'm perfectly visible and audible so today's webinar we as you all must have already read from the title of the webinar understanding sorting techniques so we are going to talk about the sorting techniques that are available to solve various questions when to use which sorting technique and you know like there are so many sorting techniques so even i as a student get confused like which one should i use and why should i use this particular one so don't worry all your questions would be answered we have a very special guest with us today yes so just give me a thumbs up in the comment section if i'm perfectly visible and audible then i'll add my guest to the stream i'm looking at the comment section just give me a thumbs up also if you have any other doubts except for certain sorting techniques you can ask them as well so yes we will definitely try to take them up after the webinar yes thank you guys for confirming we'll wait for another maybe 10 to 20 seconds so that more people can join us yes thank you vikas thank you praveen yes yes i think now we can add a guest to the stream hi kirti how are you hello nice to be here i am doing great what about you i am doing great as well as i've already told you so many times i am very excited for this webinar so let us start by having a brief introduction about yourself i am sure that most of the people who are watching this webinar will already know you because of the amazing work that you have done but still for those who don't know you can you give us a brief introduction about you thank you so much i do hope people know me because i have been on gfc multiple times now but those who don't uh hi i am kitty i have around four and a half years of experience in the industry i create content on youtube i teach i have a lot of tutorials on dsa on system design and i help with interview preparation today's video is on sorting top techniques i have a specific video on that but this is going to be a bit different and we will see how and feel free to ask me any questions this is not at all formal uh thing like keep it very chill ask me any doubts any questions that you have and also would like to know what exact queries you have in mind so that i can answer as much as possible uh to know more about me you can check me out on linkedin or in style everywhere my name so you can just search in the other five minutes yes that's really great so i would like to ask you with one of the doubt that even i had as a student so suppose a question is given to me so i see you know solutions are there on various websites with one particular suppose bubble sort is there or some other sorting technique is there so how do i identify that which is the best sorting technique for this particular question you're right uh firstly let me start from you know sorting techniques as questions that are asked from all sorts of uh like people like they are asked from freshers also they're asked from experienced people also like even uh if you see even google amazon even now like when i have four or five years of experience if they are sending me uh that what all things you should know as part of dsa sorting will always be present so sorting is a very very important topic for for all developers like no matter how much experience you have or if you're refresher or if even if you have like five six years of experience you can be asked sorry but the kind of questions that you will be asked will vary right so it will the kind of questions that will be asked to a fresher will be very different from the kind of questions that you'll be asked from like someone who has a lot of experience right even in freshers if you notice like suppose you're interviewing for a company like amazon and google like or any big company or startup which expects you to have a lot of knowledge uh you are going to expect like uh sort of trickier questions of sorting i doubt that there will be any company which is going to come and ask you that you know what just write bubble sort code or just write selection sort code and this that's the the amount of competition that has come now like the uh level that is expected from pressures also i don't think anyone is going to do that right but given that you should know sorting a lot and why and how we are going to cover in the webinar this will give you some context about sorting let me i am going to keep going through the comments as well so that you know parallely we can keep seeing that whether you guys are understanding or not right right uh there's a comment when the interviewer wants to have some fun they'll ask you to implement quicksort it is true uh but also see if any interviewer is expecting you to just implement a sorting algorithm most probably there will be a follow-up question waiting or maybe there was a question that you were not able to answer which was based on sorting and now the interview is giving you a hint that okay implement sorting and now we will see how you can solve that question right so that can also happen uh now given that the coming to the question that you were asking that you know whether how will we come to know a question is based on selection sort or insertions autism right so for that uh one thing that you should all know for sure is comparison of the sorting techniques so there are some six seven very famous uh comparison wave sorting techniques that are there right bubbles all selection sort insertions hot word sort uh heaps of quick sort these are the most famous ones so if you know the comparisons between them that which one takes uh what is the time complexity what is the space complexity and their properties in dpa the questions will definitely uh like you know be among these only so they uh well like the interviewer might ask you for example which of these sorting algorithms is online which sorting algorithm can you use if the data is coming as you are going through the algorithm let me explain more an online algorithm means that you know you're getting data as you're sorting like suppose you had like four elements now you have sorted four elements but more data is coming there's a stream of data that is coming so the only sorting technique that uh supports this is insertions right now insertion sort also has uh variations to it this binary insertionism so that is why you should know uh variations of each questions and you should know why a particular sorting technique is famous right uh let me give you another example uh for example merge sort is very very famous for uh external sorting what is external sorting uh interviewer might ask you like this that you have a lot of data like you know it can't come inside in your memory how are you going to spot the entire data so the answer to this is that you you're going to divide it into chunks and then so merge it together so you're basically using words so this is called external work sorting so it is very very less chances that will be asked more sort simply right but the interviewer will try to understand do you have the understanding that okay i can divide the data into smaller chunks uh sorted separately and then merge it together do you have that understanding to or you know really use it because this is what interviews are looking forward to know because anyone can just mug up the code of these seven eight sorting techniques and come through the interview right that is not what interviews are looking forward to now they are looking forward to can you compare the various techniques do you know which technique is famous for what part and then accordingly understand that okay the this is what i am looking forward to you might not be able to give answer in months but at least is your thought process going in the right direction right so at least that you should be able to tell you should be able to tell why you are thinking of a particular sorting discipline so this is how it is it happens let me give you another example because in commons quick sort seems to be very very common like i have seen it mentioned in like multiple comments now so another very famous question is that if you have a linked list so which sorting technique are you going to use so the answer to that is again also but if you have arrays it is better to use quick sort and not merge why is that the case because in areas there is you can do random access right and for quick sort you need random answers but when it comes to merge sort you it is uh you will need extra memory to do the merging if you have arrays while in linked lists you won't need that extra memory right so you can simply just use the linked list pointer and just do the merge right so these are the very very common questions that like right now in coming like next 30 minutes itself you will see me discussing a lot of such questions so that is the purpose of this webinar that we discuss and we understand that okay which technique can be used right so because i think everyone knows these sorting techniques these are like one of the initial few algorithms that everyone learns right like the moment you start coding the first few algorithms that you'll be doing is doing a bubble sort of selection am i not right musk right so the first three algorithms that you will write as bubbles or selection sort and being asked that in interviews is just it's different honestly right so you should be asked more trickier questions or there should definitely be follow-ups that is why such discussions can be extremely helpful yeah from my experience as well supposedly like an interviewer gave me a question once so like that question was around 10 to 15 lines and like i spent 10 minutes and then in the end i was like bubble sort implement like we had to implement bubble sort which i already knew but to find out that bubble sort had to be implemented was a task so i think that is where the thing comes that is what interview wants to see that can you able to find out that what has to be used exactly and uh another interesting thing that happens especially for people from non-cs background i'll tell you my story i knew that okay these are the sorting techniques that i use uh i code in c plus plus okay so when i was back in college i used to always implement sorting that okay i should know that or how sorting happens and all right i used to not use c plus plus stl so much there are already sorting techniques that are implemented like these while writing code or while you know solving problems or like in hackathons or like in competitive coding you're not expected to write the sorting algorithms right that is one major reason why people get so confused with this sorting techniques because they don't really use it so much there is sorting as such implemented so there are two kinds of people one will be who will never know the algorithms they'll just keep getting confused because they directly use competitive programming so i am that kind of person in second year i did not know what spls are and sds existed i used to implement then i used to say oh my god it is so tough because i was unaware about all these things exactly now some questions can be extremely simple all you need to do is just sort i remember doing this in my second or third year i i knew that it was a straightforward if i can just sort and then after that there's a very small change to be done and i'll get but i did i i was not aware of stl i did not know that okay there's already spotting that has been implemented i sat and implemented the entire sorting thing oh my god so uh yeah i was that stupid so we all make mistakes uh that is why we have webinars like this so that you know you don't do use stl sorting and stuff right now uh even coming to one step above that uh since we are talking about stl there are data structures like sets and maps which are internally as you know uh self-balanced bsd so as you insert the elements elements are already sorted so these are extremely commonly used in all interviews in all dsa interviews and questions uh because the straightforward answer is that i need the elements to be sorted so i am going to store them in a set or a map because internally it is implemented like that right so one so as a beginner you will start with knowing sorting techniques and knowing that okay there's something called as a balancing trade it can be internally implemented like this but when it comes to solving questions in like competitive programming or interviews you need to straightforwardly use sets maps or use like sorting that has already been implemented right and after that questions will be asked to you which will be like a follow up or it will be like you know how is it internally implemented or maybe there will be a tricky question in which internally you need to use like maybe a variation of sorting but it won't be straightforward right but like i've seen some of the interviewers say that do not use stl so is it the case in most of the companies or like we can use students we can i doubt there is any company that will come and tell you don't use stl maybe the company is looking for to you to you know be able to implement proper sorting and implement proper uh maybe like heapify or something like that and that is where the person said that write the entire program like for example sometimes they can say that implement this how it must be internally implemented right so that is why when they just want to see whether you have the proper understanding of sql or not because nowadays this also does your uh that you know these people are randomly using still and they don't know how things are internally implemented that is why they might ask you but mostly you know they'll be half more than happy if you are aware of hdl because that's how real coding happens in companies right you were saying something yeah so i was asking that if you have to say any four or five very commonly asked questions based on sorting as an interviewer so can you list any five questions that are you know most commonly asked in the interviews sure so we already discussed two i think whether uh in merge merge sort versus quick sort for arrays linked list that was one we talked about not sure which cells we talked about let me tell you a bit more there's uh there are many common questions okay there is like a sort of zeros ones and twos together right this is a very common question then uh there are variations of sorting techniques also like uh suppose pixot is there then there's something called three-way quick sort in which means so usually in quick sort it will be like uh less than a pivot time greater than a pivot in three-way quick so there'll also be category of equal to the pivot so there's something called three-way quick sort which is also called dutch national fact or something some name is yes yeah so they'll uh ask you questions like this or they might as i was talking about external sorting forward so this is a very very common question that you have a lot of data you have to sort then uh insertion sort is a very common question that you are given a stream of data stream of integers are coming uh tell me the median of it so usually to tell the medium i have a special video on this this is based on priority queue question right but if you are a fresher you won't be expected to solve it like that properly so if you know sorting maybe at least you can get started with with insertions of now maybe when you tell insertions or the interviewer can tell you that you know how can you improvise it further then you can say maybe i can do insertion binaries or by like basically you are putting binary search in insertion sort to improvise right so these are the very common questions that are asked that if you have more experience it can even go ahead to something like topological spot which will be for crafts trees right i'm sorry about that uh so uh now when we are talking about uh topological thoughts for advanced level there are so many hard questions that are there based on topological sources let me give you an example i recently came across a very good question on gmt it might be one of the questions that i might ask in one of my mock interviews on the channel oh it's like uh so there was a graph given and some of the edges were direction were directed edges and some were non-directed edges now the question was that how do you make sure how do you assign the directions such that you make sure there is no cycle in the graph now it seems like such a complex question right but it is a straightforward topological question that you find the topological sort and then you just assign the uh directions according so this is an expert level question or a very hard level question i will say but still it's based on the core concept of topological now they can also be questions that sound very easy but i'm very hard let me tell you again another famous question that minimum number of swaps required to make uh an array sorted right now in that case also it sounds very easy you just need to find the number of minimums right but if you see the solution on gfg it is you uh you can make a graph out of it and you have to find the number of cycles that exist now this sounds like a very simple question but it is uh not a proper sorting question is actually a graph in cycle question right so as you do more and more questions you will understand if you just open like right before the webinar i was saying sorting questions on gfc there will be a list of 88 89 questions available see 90 100 questions are there just one sorting right so there uh then these questions are of all levels easy medium hard it is just that as you do more number of questions you will get more idea about you know how you can approach the questions because see in the end there are very limited number of techniques that are famous nobody is going to expect you to really uh use shell sort and all like i i i don't even remember how those things work you are expected to know these seven eight famous comparison based uh sorting techniques and out of that you will know that okay and log n is the uh the time complexity that i can get and suppose interview is telling you you know what i want even better time complexity can you do better then maybe you can think of something non comparison based sorting techniques maybe something like counting sort or bucket sort or radix or these three are the most famous ones and then the seven months i think these 10 sorting techniques and you should be able to solve and go through all these things so i think practice and consistency is more important like when i started it also i was like there are so many techniques how am i going to you know remember all of this but after practicing for like one or two months i think like you automatically remember those exactly and making sort of cheat sheet really helps so the video that i was talking about is there on my channel i made like a proper cheat sheet comparing that okay these are the sorting techniques and what is the time complexity what is the space complexity of each of those techniques and then i have complete three properties one is is it online is it stable is it in place let me also talk about these properties a bit so that there's some idea that okay what else should you know about sorting techniques like so first properties online we already talked about it that uh if there's a stream of data that is coming data integers that are coming uh will the sorting happen like will it continue so the only sorting algorithm comparison base that is famous and that supports is insertions right then uh is a sort of technique stable statement meaning uh suppose in input they were like repeating characters right uh suppose there were twos that were coming like five six times now your question might be that i want the output in the same order as the input like if there were so many tools you sort the array but those two should be in the same order as they were there in the input right so that means uh it is is there's a algorithm stable or not will it make sure that the same number that is coming multiple times it is returned in the same order as in which it came right that is one property that can be asked because the these are very common questions it can be asked in the interview uh the person my interviewer might tell you that you know what sort the uh sort the array and then after that you the interviewer might say i have repeating numbers now make sure that the repeating numbers uh are returned in the same word you have you should know whether your algorithm is stable or not it is as simple as that this is a very simple follow-up question right then next is in place in place means does your sorting algorithm require extra space not just the input array space but any extra space other than that so if it requires extra space it is not in place uh sometimes like you know your requirement in actual work or your interview might tell you that we have we want it to be order of one space complexity or we want it to be increased which sorting algorithm are you going to use so you should know that okay which sorting algorithms can actually do that which can't do right so these are the uh that is why i always suggest that make a cheat sheet uh like you know that okay which properties are supported by which algorithms because again these are not very commonly used algorithms right that is why you should keep them in mind right i think this is a very commonly asked follow-up question wherein the time complexity reduces as you mentioned that it goes from i think of one from o of n so i have seen this question so many times in an interview like in place sorting so yeah right and uh even um sorry just one more thing so i have also seen a lot of times there can be also like for example there's a question uh sort by frequency right uh this is again like a sorting technique only right so you have to sort only now in this there are multiple solutions to this one very simple solution is that you would put the counter in a hash map and then you spot it right now the person now the interviewer will tell you i want it to be stable that means that the order in which it came i want to return it so all you have to do is make a small change in your hash map just add like a pair of integers add your index also there and then you spot based on your index as well as the copter right so there will be like small tweaks but uh they might like in your solution it might not work at all so uh in really good companies like ones who start having a good experience uh sometimes interviewer actually don't tell you uh the full question they'll expect you to ask you like you know questions uh so the interviewer might just tell you that uh sorted and then you they expect you to ask the questions ask the edge cases that if there are repeating characters if there are negative numbers how am i going to handle that so you are expected to answer ask the questions as well as answer so most early entire system design is based on this only that they will uh give you a very half question or they will give you a very vague question and they'll expect you to ask questions ask clarify the question into details and then answer it right i think that is why everyone says that ask ask as many questions as you want before you start the question like understand the question before you start answering it exactly there are actually a few edge cases that are very common and i i have a very short one minute video of covering the edge cases also on my channel where i talk about you know what are the usual common edge cases that we should think about like uh negative numbers zero or uh integers going out of bound or when you add two big numbers these are very common edge cases that you should keep in mind like while asking questions or by solving any questions right so you can probably make like a list or a cheat sheet or when you're solving the more you practice the more you'll get an idea oh this was the edge case that i missed and next time you do a question you keep it in mind or you write it somewhere it you know i should think of this excuse of a similarized case that is why practice always helps you when when it comes to dsa also the question that you mentioned the median one i personally followed your video i saw so many videos on youtube i was not able to understand that particular answer but then thankfully i came across a video in which you were explaining each and every step and after that i did not forget that particular solution so yes guys definitely check that video out thank you so much that's actually such a common question and unless you have seen the question before it is highly unlikely that you will be able to solve it i personally took a lot of time to understand that question and then after that video has released i have seen so many people uh so my car commenting that we got a job or we cleared a particular interview around because of this question and that's i think the most fulfilling thing that can happen to a content creator when i started these content creation journey i had no idea that okay this is where i will be but i just wanted to make these tough concepts very simple once you understand it it looks very simple but if you have not gone through it it's like how are you even going to think of it in the interview yeah definitely i could not have thought that i have to use priority queue to find the media or like i was like okay stream of numbers what do you exactly mean by it i think if a student will get it in the interview i don't think that thing will come as you mentioned exactly but you know priority queue is a very uh that sort of data structure that is extremely rarely used but once you do that question and once you do a few more questions of priority queue you understand that you can start implementing it even i was surprised the first time i started using priority queue without seeing the solutions i was like oh my god we can do this i am able to think of a solution with priority queue it's like a very nice feeling for any developer who is practicing dsa that okay for myself i thought of her you know using parrot if you are of a technique that is so rarely used but once you do these questions more and more you will be able to do them and soon even i used to scare scare away from priority queue that i won't be able to implement it but now it is one of my favorite data structure to solve questions this is so nice since we were talking about edge cases and we are talking about sorting algorithms actually uh i remember counting sort as well as buckets bucket sort both of them have variation like you know they you need a range of numbers for that right and counting sort if you have like a range of numbers you do the implementation the interval will go like very good but this won't work if there are negative numbers so you have to think of uh you know uh why the person is asking you that okay implement this you have to keep it in mind are there negative numbers going to be available there's another very very famous algorithm which is called cadence algorithm it is for sub array sum for that also if the the prerequisite is that there should be at least one positive number or one non-negative number available and if that is not the case your algorithm is not going to work so be it sorting techniques speed any algorithm you should know uh the edge cases or you know when your algorithm is not going to work when it is going to work so just keep these things in mind and when people say what exactly should you go through one day before the interview or right before the interview write these things down in a place and like revise it because you have the understanding i understand that you have understood the sorting techniques you know that okay this is what will be used but remembering that okay now this won't work for negative numbers or remembering that okay this sorting technique can be used sometimes you tend to forget so i would highly suggest to meet your cheat sheets to make notes and to go through them one day before the interview or one day before the exam or complicated programming in case if you are a beginner once you go through it you will you will be able to answer i'm sure but like at least in the beginning stage you should be able to do this right so there are questions on time complexity like people are writing should we just learn the time complexity of all the various algorithms that are there or is there some way that you know we can easily find out the correct time complexity right so uh it's a very good question because people do get confused especially beginners see usually they will uh expect you to tell the worst case complexity only you you have to tell there is something called master theorem which is used to calculate the average complexity but never have i seen that that is expected of you in an interview right so don't uh put your head so much into it you should be able to tell worst case complexity and best case complexity like in since we're talking about sorting techniques uh when will be the best case scenario when the array is already sorted right when will be the worst case scenario when the array is completely like not sorted it is in reverse or direction right uh so now don't bother so much about average case but you should have an idea that okay uh if it is my best case scenario can i improve the time complexity like for example in a bubble sort of selection sort yeah suppose in a bubble sort the first time you do the bubbling you see that i didn't have to exchange anything right that means it is already sorted it is the best case scenario so in that means your order of complexity you can go from order of n square to order of n that is when the interviewers will expect you to talk about it because worst case complexity was order of n square you need to do the bubbling end times always right but it was in the opposite direction but once you notice that okay i don't need to do the bubbling you just do this small tweak in your algorithm you put that extra check and your complexity improves from order of n square to order of n right so no interviewer i don't think people are going to expect you to you know calculate the average and worst and all of that and use master theorem no but they expect you to have the understanding that okay if i need to improvise the algorithm can i put an extra check and improvise so that is where it comes in a picture i lost your voice mascara i'm sorry i was on mute is there any list of all algorithms for all kinds of problems that we can refer see honestly now the nowadays list is available almost everywhere since we are talk we are on gfc channel i can assure you that i have gone through the fc content and good uh curated list is present you just type the gsg dsa gmc algorithms it is extremely well written and divided you can see questions related to each sorter like each data structure also that within one linked list these are the questions for arrays these are the questions for these these are the questions and even for algorithms for like for searching there is there are different algorithms for sorting there are different algorithms there are say hundred hundred questions for each i i would say don't go through all of them but go through at least few of them to get this general id right suppose for the starting like go through 10 10 of each kind then after that if you have more time go through 10 10 more of each kind after that you will get more generic idea and you'll be able to identify the questions so that is how you can go about it but there are good there is good content available online guys so you don't have to bother so much just put your head into it and just practice following uh one cheat sheet or just following one sheet is uh i think what helps the most like if you're following 10 cheat sheets or 10 uh sheets i think that won't be advisable like follow one and you know it's completed basically right you might be like repeating the same things again and again and might not be very helpful just pick one thing and make sure that you're finishing it you're going to end like i've seen so many people who start with is linked list but they never reach craft questions trees questions like even with sorting you will always do these seven comparison pace sorting techniques uh you will maximum do radix count and bucket sort you will never reach topological because for topological sort you need to know dfs you need to have like basic idea about graphs nobody really gets there like i don't mean nobody i mean many people don't get there but so like whatever you're picking make sure that you finish it and then you move ahead uh so you'll have a much better chance you'll be able to identify questions okay so then there's a general question on dsa like how many topics of maths are important for dsm mainly what all mathematics topic are important so as to solve the essay question see it depends uh again it's a very uh subjective question i think that it depends on a lot of things uh maths i think a bit of geometry a bit of maybe randomized numbers and all of that is required but in interviews it is more of problem solving in dsa than core maths i would say maybe catalan numbers and all you should know beneficial binary meal questions coefficient you should know but all that it's very rarely asked it's not very commonly asked questions i will say one more thing i would like to say since we're talking about sorting and implementation of sorting many times then you can understand from the uh expectation uh from the time constants itself from the constraints like for example it is given that your n range is still order of five or order of four so you know that you can quote in order of n log n or you know that i can go till with what can be my worst case time complexity right so you can also reverse the engineer over there and say that okay if i can have order of n log n maybe i can do sorting in this and why do i need to do sorting in this how can i do the sorting right so maybe you start thinking in the opposite direction also sometimes that maybe if you are not able to directly identify that this is a sorting question the more number of questions that you solve you can see that okay uh what is the constraint okay i can have this time complexity okay maybe i can do something or binary something like that then there's a question from naveen that can we use building functions in uh interview yes that is what i was talking about you should definitely use them unless mentioned by the interviewer that don't use them in fact interviews will be happy to know that you know of these functions right that means you are well prepared and you use these functions so use these functions and until like if the interview says that can you please implement this built-in function then you go ahead and implement it but you can definitely use this yes then again there are a question there was a question on cheat sheet as you already mentioned that there are a lot of cheat cheats available online so you can refer any one of them whichever suits you the best great then there's a question is astar algorithm asked an interview i've never heard of this algorithm actually these even if this has to be extremely rare especially from pressures and all i don't think they'll ask you this interviewers mostly want to see your thought process and not see whether you have mugged up particular algo or not right so focus on that yes okay i think we've taken of all the common questions from the comments i'll just go through them once again sure and guys if you have any further doubts about any particular questions or anything feel free to reach out to me on insta youtube linkedin anywhere i'll definitely take it up and try to help you as much as possible really hope you found the session helpful let us know your feedback also in the comments and well i would definitely like to improve it okay then we need to answer the exact time complexity in the interview is one question that i just got like finally yeah uh yes this is a very important point in any dsa round you should be able to tell the time complexity not exact type complexity uh but like worst case time complexity or amortized in complexity you should be able to tell reference you can refer to the mock coding interviews that are there on my channel you can see every time we discuss uh any question uh or a mock interview you can see first thing we discuss is time complexity in fact a lot of times the feedback can be negative because the person did not cover time complexity or space complexity so this is like a must do in any dsa as soon as you talk about an algorithm talk about its efficiency yes then uh there's a question that he has been working in the industry for four years and he self-taught struggles with this basically a particular roadmap that he can follow he's asking if you can suggest any particular roadmap hi so i am also with four and a half years of experience i am also said plot i have not taken any paid course i work for dsa and i understand that it can be a fixed struggle so i would say pick up any one place we let it be gfc elite or any any one place do a practice in a very structured manner start with arrays linked lists stats queues uh do many questions related to it then goes then go to trees graphs then once you do topic wise questions go from easy to medium to hard right don't do do just medium questions or just hard questions for just easy questions do a mix of difficulty level and once you do a lot of questions when so you have enough practice then you pick up random questions and see whether you can identify the question belongs to with category right and make sure maybe you can get started with like sorting algorithms binary search and these are like pc algos that you can get started with then go ahead and try to practice as possible practice is the key for dsa you have to do as many questions as possible yes yeah there's a question about language i don't know in every webinar there's one question about which language to follow for dsl any language as as long as you are comfortable with it uh i personally use c plus plus many people use c plus first you can use java you can use python you can use c sharp use whatever you want be better with the concepts of the language and how to implement it how to use in competitive programming or dsa interviews good too another question is it advisable to mug up some algo if interviews are close enough and if i am not prepared no please don't do it rohan trust me interview will somehow come to know that you have marked up the question they will be follow-up questions there will be questions on time complexity space complexity and the amount of time that you will put up in mugging up questions you can put it in understanding the question this has happened with me i have taken a lot of interviews and into it and i have seen uh like i remember once i asked a dp question a person wrote all the conditions all the edge cases everything i saw two conditions were reversed and i told k explain and the person was not able to explain i confused so much and i knew the person has just marked it up and he or she did a brilliant job in mugging it up in writing the entire thing just like a small mistake and i knew that the person has not done it and i asked a lot of follow-up questions and person was not able to answer 99.99 of the times you will be caught and there is no long-term solution like you will this is not going to help you in long term so please don't do it right i think understanding is better like if you spend good half an hour one hour in understanding some particular thing i think you'll remember it automatically like you don't have to mug up actually so that works okay naveen is again asking instead of these sorting algorithms we can directly use these stl right map so namine we actually talked about this in the webinar that uh it is good to use it in um just test here but uh there will be a lot i gave the last like 45 minutes i gave a lot of examples of like variations of sorting techniques which are asked as questions themselves you should know them an interviewer can anytime ask you that implement this particular technique or why to use a particular technique in a particular scenario i give a lot of examples of questions do go through the webinar once more to know what are these questions right also there is one question which have which i'm remembering is in sort stl like which sorting technique is used i think one of my friend got this question even i don't remember the answer right now like simple sort stl what is the sorting technique right so it depends on internally how is it implemented but usually there is uh it will be order of n log n will either keep sort of merge sort so you can always say that it is order of n log okay does including that we'll just take one or two more questions and then i guess we are good to go here this indentation matter depends on the interviewer i personally find that you it should not like it's better to win end properly but uh shouldn't matter really that much right so yeah i think there are a lot of questions from other topics as well so in this we like to stick to the sorting techniques questions i think we have already covered all of them so now lies lastly i would like to thank you katri for doing this i hope it helps a lot of students who are watching this thank you so much thank you so much for having me and i hope i continue coming on gfc more and more i hope everyone found this session helpful let me know your feedback i would like to improve and how we can help you more i would love to know and yeah thank you so much thank you bye

Original Description

Are you Carnival ready? Because we have got you covered for one full week of fun-filled coding activities and insightful webinars where you will meet the best of the industry giants. Not just this, you will also receive hefty discounts on all our courses, get introduced to hundreds of job opportunities and get chances to win exciting rewards! Enter the carnival here - https://practice.geeksforgeeks.org/summer-carnival-2022 Comprehending the nuts and bolts of sorting algorithms can be daunting. But, getting comfortable talking about some of the well-known algorithms may help you ace a programming interview. So, without further ado, let’s dive right in with Keerti Purswani, software developer and content creator. Connect with Keerti - https://www.linkedin.com/in/keertipurswani/ #programming #sorting #codingquestions #gsc2020
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from GeeksforGeeks · GeeksforGeeks · 36 of 60

1 How I got into Walmart | Shailesh Sharma
How I got into Walmart | Shailesh Sharma
GeeksforGeeks
2 Upgrade yourself In 29 Days | GeeksforGeeks
Upgrade yourself In 29 Days | GeeksforGeeks
GeeksforGeeks
3 Learn AWS Fundamentals For Free
Learn AWS Fundamentals For Free
GeeksforGeeks
4 Conversation With Young Achievers | Meet the winners of Bi-Wizard Coding Contest | GeeksforGeeks
Conversation With Young Achievers | Meet the winners of Bi-Wizard Coding Contest | GeeksforGeeks
GeeksforGeeks
5 Meet The Winners Of Bi-Wizard Coding Contests | GeeksforGeeks
Meet The Winners Of Bi-Wizard Coding Contests | GeeksforGeeks
GeeksforGeeks
6 Interview Prep Strategies | PayPal
Interview Prep Strategies | PayPal
GeeksforGeeks
7 OLX Interview Preparation Strategies | Hukam Singh
OLX Interview Preparation Strategies | Hukam Singh
GeeksforGeeks
8 Meet Some More Winners Of Bi-Wizard Coding Contests | GeeksforGeeks
Meet Some More Winners Of Bi-Wizard Coding Contests | GeeksforGeeks
GeeksforGeeks
9 Live Mock DSA
Live Mock DSA
GeeksforGeeks
10 Microsoft Azure For Absolute Beginners
Microsoft Azure For Absolute Beginners
GeeksforGeeks
11 Python for Data Science | Data Science Master Bootcamp | Arpit Jain
Python for Data Science | Data Science Master Bootcamp | Arpit Jain
GeeksforGeeks
12 Getting Started with Data Analysis | Data Science Master Bootcamp | Ashish Jangra
Getting Started with Data Analysis | Data Science Master Bootcamp | Ashish Jangra
GeeksforGeeks
13 How to prepare theory subjects for SDE interviews | Geeks Summer Carnival 2022
How to prepare theory subjects for SDE interviews | Geeks Summer Carnival 2022
GeeksforGeeks
14 Get Your Tickets To The Geeks Summer Carnival | GeeksforGeeks
Get Your Tickets To The Geeks Summer Carnival | GeeksforGeeks
GeeksforGeeks
15 TED Talk Data Analysis Project | Data Science Master Bootcamp | Ashish Jangra
TED Talk Data Analysis Project | Data Science Master Bootcamp | Ashish Jangra
GeeksforGeeks
16 How I Secured AIR 9 in GATE'22 |  Tushar
How I Secured AIR 9 in GATE'22 | Tushar
GeeksforGeeks
17 Learn Java Backend Development | Geeks Summer Carnival | GeeksforGeeks
Learn Java Backend Development | Geeks Summer Carnival | GeeksforGeeks
GeeksforGeeks
18 How to Recognize which Data Structure to use in a question | Geeks Summer Carnival | GeeksforGeeks
How to Recognize which Data Structure to use in a question | Geeks Summer Carnival | GeeksforGeeks
GeeksforGeeks
19 Learn Data Structures and Algorithms | GeeksforGeeks
Learn Data Structures and Algorithms | GeeksforGeeks
GeeksforGeeks
20 Interview experience at Flipkart | GeeksforGeeks
Interview experience at Flipkart | GeeksforGeeks
GeeksforGeeks
21 Lets Prepare for GATE'23 the Right Way | Sakshi Singhal | GeekSummerCarnival
Lets Prepare for GATE'23 the Right Way | Sakshi Singhal | GeekSummerCarnival
GeeksforGeeks
22 Highest Paying Jobs in 2022 | Ishan Sharma | Geeks Summer Carnival 2022 | GeeksforGeeks
Highest Paying Jobs in 2022 | Ishan Sharma | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
23 Geeks Summer Carnival 2022 | 5th April- 11th April | GeeksforGeeks
Geeks Summer Carnival 2022 | 5th April- 11th April | GeeksforGeeks
GeeksforGeeks
24 Preparing for SDE interviews | Soham Mukherjee | Geeks Summer Carnival 2022 | GeeksforGeeks
Preparing for SDE interviews | Soham Mukherjee | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
25 Full Stack Development with React & Node | Utkarsh Malik | Geeks Summer Carnival | GeeksforGeeks
Full Stack Development with React & Node | Utkarsh Malik | Geeks Summer Carnival | GeeksforGeeks
GeeksforGeeks
26 Introduction to Open Source and Roadmap to GSOC 2022 | Geeks Summer Carnival 2022 | GeeksforGeeks
Introduction to Open Source and Roadmap to GSOC 2022 | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
27 Web Scraping in Action | Geeks Summer Carnival 2022 | GeeksforGeeks
Web Scraping in Action | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
28 Getting Hired at BITCS via GfG Job Portal | Get Hired With GeeksforGeeks
Getting Hired at BITCS via GfG Job Portal | Get Hired With GeeksforGeeks
GeeksforGeeks
29 How to build a faster landing Page | Geeks Summer Carnival 2022 | GeeksforGeeks
How to build a faster landing Page | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
30 Geeks Summer Carnival | 5th To 11th April, 2022 | GeeksforGeeks
Geeks Summer Carnival | 5th To 11th April, 2022 | GeeksforGeeks
GeeksforGeeks
31 How to get ideas for Startup | Geeks Summer Carnival 2022 | GeeksforGeeks
How to get ideas for Startup | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
32 Journey from Tier 3 to JusPay | GeeksforGeeks
Journey from Tier 3 to JusPay | GeeksforGeeks
GeeksforGeeks
33 Geeks Summer Carnival 2022 | GeeksforGeeks
Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
34 Dispelling Myths and Pre conceptions of Programming Languages
Dispelling Myths and Pre conceptions of Programming Languages
GeeksforGeeks
35 Must Do System Design Questions
Must Do System Design Questions
GeeksforGeeks
Understanding Sorting Techniques in an hour | Keerti Purswani | Geeks Summer Carnival
Understanding Sorting Techniques in an hour | Keerti Purswani | Geeks Summer Carnival
GeeksforGeeks
37 Get Hired at NEC | Job-A-Thon 8
Get Hired at NEC | Job-A-Thon 8
GeeksforGeeks
38 Journey from Tier 3 college to Microsoft | GeeksforGeeks
Journey from Tier 3 college to Microsoft | GeeksforGeeks
GeeksforGeeks
39 Get Hired with GeeksforGeeks at SuperK | Job A Thon 8
Get Hired with GeeksforGeeks at SuperK | Job A Thon 8
GeeksforGeeks
40 GeeksforGeeks: Redesigned
GeeksforGeeks: Redesigned
GeeksforGeeks
41 From Tier 3 to cracking multiple interviews | GeeksforGeeks
From Tier 3 to cracking multiple interviews | GeeksforGeeks
GeeksforGeeks
42 Live Mock DSA
Live Mock DSA
GeeksforGeeks
43 Youtube Data Analysis | Ashish Jangra | GeeksforGeeks
Youtube Data Analysis | Ashish Jangra | GeeksforGeeks
GeeksforGeeks
44 DSA Self-Paced Course Preview | Sandeep Jain | GeeksforGeeks
DSA Self-Paced Course Preview | Sandeep Jain | GeeksforGeeks
GeeksforGeeks
45 GATE Live Classes | Prepare for GATE CS 2023 | GeeksforGeeks
GATE Live Classes | Prepare for GATE CS 2023 | GeeksforGeeks
GeeksforGeeks
46 Journey from JIIT to Adobe
Journey from JIIT to Adobe
GeeksforGeeks
47 Life Is Unfair Ft. Shonty badmash | LIVE Discord Session | A GeeksforGeeks Exclusive
Life Is Unfair Ft. Shonty badmash | LIVE Discord Session | A GeeksforGeeks Exclusive
GeeksforGeeks
48 Interview Experience at Google | Tech Dose
Interview Experience at Google | Tech Dose
GeeksforGeeks
49 Live Mock DSA
Live Mock DSA
GeeksforGeeks
50 Interview Experience @ Amazon | GeeksforGeeks
Interview Experience @ Amazon | GeeksforGeeks
GeeksforGeeks
51 My journey through the tech world from India to US | Vidushi | GeeksforGeeks
My journey through the tech world from India to US | Vidushi | GeeksforGeeks
GeeksforGeeks
52 Complete Interview Preparation Course | GeeksforGeeks
Complete Interview Preparation Course | GeeksforGeeks
GeeksforGeeks
53 Live Mock DSA
Live Mock DSA
GeeksforGeeks
54 Getting Hired at FiftyFive Technologies | Job-a-thon 9.0
Getting Hired at FiftyFive Technologies | Job-a-thon 9.0
GeeksforGeeks
55 GFG Karlo, Ho Jayega | GeeksforGeeks ft. Khaleel Ahmed
GFG Karlo, Ho Jayega | GeeksforGeeks ft. Khaleel Ahmed
GeeksforGeeks
56 How I got job offers from 2 big companies : Arcesium & Microsoft | GeeksforGeeks
How I got job offers from 2 big companies : Arcesium & Microsoft | GeeksforGeeks
GeeksforGeeks
57 LINUX for Beginners | GFG x Itversity
LINUX for Beginners | GFG x Itversity
GeeksforGeeks
58 My interview experience at Walmart | GeeksforGeeks
My interview experience at Walmart | GeeksforGeeks
GeeksforGeeks
59 Get Hired at Speckyfox
Get Hired at Speckyfox
GeeksforGeeks
60 Live Mock DSA
Live Mock DSA
GeeksforGeeks

This video covers the basics of sorting techniques, including Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, and Quick Sort, with a focus on understanding the algorithms and their complexities.

Key Takeaways
  1. Define the problem and identify the sorting technique to use
  2. Choose the appropriate sorting algorithm based on the problem size and complexity
  3. Implement the sorting algorithm using a programming language
  4. Analyze the time and space complexity of the sorting algorithm
  5. Compare the performance of different sorting algorithms
💡 Understanding the trade-offs between different sorting algorithms is crucial for efficient problem-solving.

Related Reads

Up next
Webhooks & Callbacks For Beginners in Python
NeuralNine
Watch →