The 10 Most Important Concepts For Coding Interviews (algorithms and data structures)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up everybody how's it going in this video i'm going to be covering 10 super important algorithms data structures and general topics or concepts that you need to know for coding interviews now two little caveats the first one is that i'm going to be going through them pretty quickly this video is not meant to teach you these topics just to tell you about them and secondly these are not the 10 only things that you need to know for coding interviews there's a lot more that you could know these are just the 10 most important ones in my opinion if you want to know everything there is to know about coding interviews and if you want to practice which you should if you're trying to land a job as a software engineer then definitely check out my company i'll go expert we've helped over 70 000 engineers prepare for their technical interviews go to algoexpert.io and use a promo code clem clem for a discount on the platform last thing before i jump into the first topic i'm trying to grow my instagram i've been pretty bad at posting recently but i just posted a new picture and i'm gonna try posting a lot more pictures of just my general life not necessarily related to coding or software engineering all sorts of things lifting my general life behind the scenes so if you're interested in that go check it out clement underscore mihaela scoop the link is in the description below and now let's jump into the first thing that you absolutely need to understand really well for coding interviews which is the logarithm the math concept it's probably the only real math concept that you need for coding interviews but it is imperative that you understand how the logarithm works you have to appreciate why a logarithmic time operation or algorithm is so much faster and therefore better than a linear time algorithm or operation we have a free video about the logarithm on our data structures crash course on algo expert it's about 15 or 20 minutes i think that i explained the concept pretty well there definitely go check it out once you understand the logarithm you will do much better in your complexity analysis and coding interviews and therefore in your entire coding interviews now the second topic that is super important to master for coding interviews is graph traversal and when i say graph traversal i'm also talking about pre-traversal matrix traversal because matrices are basically kind of like graphs in a way you have to know how to do depth first search breath first search i hate these two words dfs bffs you have to know how to traverse through cyclic graphs so you have to know how to keep track of visited nodes in some sort of auxiliary data structure super important most on-site interviews will have at least one interview that consists of a graph problem where you're gonna have to traverse a graph so definitely make sure that you're comfortable with graph traversal now the third thing that you need to know for coding interviews this is a specific algorithm it's binary search binary search is a pretty easy algorithm most people learn it either at the beginning of their coding bootcamp or in their intro algorithms class in college it's a pretty easy algorithm but most people at least i know i did take it for granted and then kind of forget about it and then they just stop using it and they resort to linear search and this one ties back to the first point the logarithm binary search is way way way way better than linear search like so much better because it runs in log event time and in a lot of coding interviews you will have a difficult problem that involves binary search in the solution like a sub problem of the greater problem will need binary search because you'll be repeatedly searching through sorted values for example and you'll want to use binary search so be comfortable with binary search be comfortable implementing it be comfortable knowing when to use it when there's basically sorted values and it's going to really help you a lot the fourth concept that's very important for coding interviews is the sliding window technique now the sliding window technique is something that involves manipulating two pointers or two indices at the same time as you're traversing through something like a string or an array so basically you've got a left pointer or left index a right pointer right index and you move them simultaneously in an array or a string usually to count frequencies of maybe characters or maybe to count uh the sums of sub-arrays in an array where you can you know add like the the the number on the right and then subtract the number on the left right you can see how it's useful and then sometimes you'll need to expand the window on the right and shrink it on the left or other times you'll have variations where you're iterating through a data structure and then you are creating the two pointers and expanding them both at the same time outwards like in the longest palindromic substring problem the point is being able to to comfortably manipulate two pointers at the same time and traverse the data structure can be very useful a lot of problems have that as a solution and so you want to be comfortable with it the fifth topic that's super important for coding interviews is recursion now recursion is useful for two reasons first of all really understanding recursion and being comfortable with recursion and solving things recursively is very good from a logic perspective like it it teaches you logic it really makes sure that you understand how functions work how function calls work you know what's returned from functions all that good stuff but then also there are a lot of problems that can be solved recursively much more easily than iteratively like implementing them recursively is just much easier the code is much cleaner much less code than their iterative counterparts a good example is um you know inorder traversal of a tree we have a problem on algo expert that's a very hard problem uh or a heart problem i forget called iterative inorder traversal and the reason it's hard is because traversing a tree in order iteratively is pretty difficult to implement at least in code whereas recursively it's pretty trivial so if you're really good at recursion and you understand it well then you're going to be able to solve certain problems in coding interviews much more easily than if you go down the iterative path and you want to be able to to have that ability so definitely make sure your recursion is up to par there are a lot of classic pretty easy problems that just make sure you understand recursion really well like n fibonacci or uh you know calculating the height of a binary tree or the depths of nodes in a binary tree just go do all those practice problems is really going to help you a lot okay number six here i'm going to cheat a little bit and give you two algorithms that you want to know for coding interviews inverting a binary tree and reversing a linked list now hear me out i know that these two algorithms are basically memes at this point i have contributed or rather algo expert has contributed to perpetuating the memes-ness of these two algorithms because we use them in our ads on youtube but the reason it's important to to know how to do these two things uh well is for inverting a binary tree it's important because it's just a very easy problem like so many people make it sound like inverting a pioneer 3 is super difficult it's not it's a very easy problem it just comes down to traversing a tree and swapping values like it's just very easy if you're intimidated by inverting a binary tree you probably just have a misconception of what it is to infer a binary tree go check out the problem and i'll go expert it's really easy and it'll just give you confidence it's an easy problem now reversing linked list is a little bit different the reason it's important to know how to do that is because i think we can all agree that linked lists are an important data structure they allow you to do operations much faster or certain operations much faster than with arrays and you're likely going to face a linked list problem in a coding entry but if you've done a lot of linked list problems like all the ones on elgo expert you've probably noticed that linked list problems tend not to be too difficult algorithmically it's just like the same thing every time like shifting values in a linked list or rearranging a linked list and if you know how to reverse a linked list you probably will know how to do most other manipulations in a linked list that you could face in an interview because it's basically the same thing just knowing how to manipulate you know nodes in a linked list knowing how to overwrite pointers making sure to to do so in a specific order such that you don't lose reference two nodes in the linked list and voila so know how to reverse the linked list and you will be great for most linked list problems number seven suffix trees so suffix trees are pretty advanced data structure they're relatively complicated data structure but the the thing that i want to impart you with here is you can create a data structure that looks similar to a suffix tree just with objects like javascript objects or python dictionaries very easily and it's a very powerful data structure that can help you especially with string problems when you are trying to find whether a bunch of strings are contained in another string and you want to do so quickly rather than iterating through all the strings and doing a bunch of you know substring matching and all that creating a suffix tree or a tree-like structure that contains the strings in them is going to be much better it'll be a much quicker solution and um it's going to impress your interviewers because it tends to be a pretty advanced data structure so be comfortable with suffix trees we've got a few problems about it then on algo expert and let's move on to number eight heaps heaps are another relatively advanced data structure although not really because ultimately when we're talking about heaps in the context of coding interviews usually we talk about binary trees by creeps binary trees binary heaps which are basically like binary trees and usually we're talking about min heaps or max heaps that have a special property and here again we go back to that logarithm thing that we talked about in point number one the reason heaps are super useful is because they have this logarithmic time operation to find the minimum value in the min heap or the maximum value of the max heap being comfortable with heaps really understanding how they work is going to help you a lot for all the problems where you have to repeatedly find the smallest or the largest values in groups of values and i think that going through uh constructing a min heap or a max heap can be can be very empowering because it really shows you like how the data structure works how you can represent it very simply and elegantly with an array and yeah just make sure you know heaps they will help you a lot in tough interview problems number nine dynamic programming a lot of the hardest coding interview problems that you're going to encounter can be solved with dynamic programming dynamic programming is this fancy term for really just being able to solve a problem that is pretty complex by first solving a smaller version of that problem and to solve that smaller version of that problem you solve an even smaller version of that problem all the way up until you can solve a trivial version of the problem if you become comfortable with dynamic programming by doing a lot of such problems a lot of dynamic programming problems you'll be super well equipped for these difficult problems and yeah this is a very useful tool you gotta know for coding interviews and in my opinion dynamic programming is one of those topics where practice really does make perfect the best way to get good at dynamic programming is to do a lot of dynamic programming problems which is why we have a lot on algo expert the tenth and final topic that i think is very important to know for coding interviews is sorting algorithms specifically i'm going to go with quick sort and merge sort all the sorting algorithms are important to understand but i think quicksort and word sort are really the the two like very famous and popular fast sorting algorithms heap sort of just i don't know screw heap sort but um quick certain merge sort they're very important the reason they're important is not so much that you're gonna get asked to implement them although you can i remember at two sigma the the hedge fund in in new york i was asked i think to implement quicksort which is a bit of a weird question i don't think that a company like google would ask you that but it's important to understand them because once you understand them you truly understand why they run an n log n time and you really understand why they're so much better than bubble sort and if you understand how they work fundamentally it's hard to forget them like a lot of people say like oh you know i haven't written quicksort in so long so i've forgotten how to do it but if you understand how quicksort works you know that you choose a pivot and that with the pivot you just swap elements that are smaller to the left of the pivot and bigger to the right of the pivot then you're able to reimplement it yourself pretty easily even if you haven't done so in a super long time so trying to understand the two algorithms very helpful in my opinion very empowering and it'll make you not like feel anxious about potentially not knowing them in a coding interview because you'll just be able to derive them on the spot and on top of that quick sort is particularly helpful because of a quick select which is a sort of variation of quick sort for searching for certain values like searching for the case smallest or largest value in an array and if you know quick sort if you know how quicksort works and you know how to re-implement quicksort because you can derive it then you can implement quick select which can be helpful in those types of problems searching for the case smallest or largest value so with that these were my 10 top topics that i think you need to know like i said i went through them pretty quickly if you don't you know know any of these things right now then you definitely need to practice and learn them algo expert is a great tool for you definitely check it out otherwise if you found this video helpful don't forget to smash the like button it really helps me out subscribe to the channel if you haven't already follow me on linkedin and twitter if you enjoy short formatting content instagram if you like pictures and i will see you in the next video
Info
Channel: Clément Mihailescu
Views: 85,309
Rating: 4.9447203 out of 5
Keywords: top 10 algorithms for the coding interview, most important algorithms and data structures, important topics for coding interview, coding interview concepts, coding interview algorithms, coding interview data structures and algorithms, coding interview tips, most important concepts for coding interviews, what to know for coding interviews, coding interview preparation, important algorithms and data structures, top coding interview questions, coding interview data structures
Id: Ge0Udbws1kc
Channel Id: undefined
Length: 13min 18sec (798 seconds)
Published: Fri Jul 02 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.