Placeholder Image

字幕列表 影片播放

  • Hi, I'm the Tech Lee.

  • Then today I'll be the tack lied.

  • I wanted to talk today about some of the top algorithm snow for the coating interview.

  • I've conducted over 100 interviews for large tech companies, and I've also gone through interviews myself, too.

  • So I thought that would share some of my top tips.

  • As you're preparing for your interviews today, we're drinking coffee.

  • I'm taking it black because it is a serious topic and I'm a serious man.

  • Oh, that is so professional.

  • Aroma is just so sophisticated now.

  • There are a lot of different algorithms to study and to know, but I thought I would keep you in on some to focus on especially one of the top algorithms to know is treat reversal free trove are so is used heavily in industry, and I would be highly surprised if you went through an interview without getting asked at least one tree trimmer.

  • So question.

  • If you think about it, there's not that many tricky algorithms.

  • There's a few you got then, though, and that you should know very well.

  • And one of them is preacher reversal.

  • So as far as that goes, this involves knowing how to reverse a tree in a number of ways.

  • There's pre order to reversal in order to reversal.

  • Post order Traverse, Oh, breath, first search and Deaf research.

  • One comment problem is given a few hierarchy where there's a view, sub views and sub sub views.

  • Trevor's every view and print the view.

  • This can be modeled as a tree problem, and you should not have to do it.

  • Recursive lee and educated they're males would be scenarios where you need to do breath.

  • First search to find the nearest note that matches some criteria.

  • The binary search algorithm also occasionally shows up in interviews where you need to transfer some tree structure, looking for some note and that can be done in log rhythmic time.

  • You should also know how to use data structures to represent a tree in my data structure scores.

  • They talked restructures as having a note with a left note in the right note.

  • But I think that was probably kind of naive because that limits the fan up to two.

  • And if you want more larger fan outs than what really makes sense, is just having an array.

  • So really all you need to represent a tree is a note with an array of Children.

  • Those insights Now we know that Riker Jin is a common way to trippers thes tree structures.

  • But surprisingly, a lot of people think they know Rick urgent, but I don't think they know it well, and they don't know it elegantly.

  • And what commonly happens is that when you start writing a recursive function, you start needing to pass parameters to represent state, and then your recursive function gets bigger and bigger, and you start needing to pass a bunch of variables into it.

  • So one thing to think about is commonly recursive.

  • Programs need helper functions where you call into the recursive program and in their workers, a program called Stranger to help her function, but passes in a set of initialization variables that can help keep your coat and a P I clean.

  • You also want to think about what your base case is because if you can clarify what that base cases, at what point the recursive function will end, that usually helps you write a cleaner function.

  • Reversion is another favorite interview question, and I would be surprised if it weren't asked not the thing to know is commonly in tech.

  • Riker Shin is not actually used all that often because it is limited to stack space.

  • Because of that, Rick urgent has limits, and it's not the optimal.

  • And usually what professional developers would do is comfort that into an inter their function.

  • So this is where you can start looking into getting extra points.

  • It's good to know that every recursive algorithm can be converted to a negative algorithm using stacks queues.

  • And I encourage you to try practicing out some of this stuff like Fred taking one of your favorite algorithms like, say, Fibonacci or treat reversal and try implementing that aggressively and see what you would need for that.

  • You might find that in some scenarios, somewhere occurs of algorithms are actually pretty difficult to do figuratively and others are not.

  • And that really depends on how much state you're passing from one recursive in duration to the next one.

  • So that's just a pro tip is.

  • Sometimes all the interviewers looking for is a recursive algorithm, because the interest of algorithm may require too much overhead to complete, But you want to keep that in mind.

  • Speaking of Stax accused.

  • These are often used very commonly interview questions.

  • One coming question is given the string of parentheses.

  • Check.

  • If they're balanced and I can be done with a stack, you just push them and pop them as you go.

  • Most languages have support for Stax and cues like a ray pop push shift on shift factors.

  • So you just want to want to make sure you're familiar with those languages, syntax and features.

  • The other one to know here is object or into programming, which also comes up quite often in interviews.

  • And you're going to want to bring out the object or in deprogramming wherever you can, just to show that you have some sense of constructors and organizing code.

  • So for whichever language you're choosing, make sure you know how to create a class in that language said that methods, private variables, public variables and, as you approach of problems, start thinking about what potential data structures you may need to solve the problem.

  • And if it makes sense to create a class for that, sometimes using classes can even simplify your work.

  • For example, instead of using a toothy array to represent a grid you can set up a grid class, and then you can just use that grid class and call methods on it and pretend that these methods exists and fill the men later.

  • If you have time, that might actually help you save some time, because you can assume that this class will help take care of things like EJ checks.

  • Sanitation validation maybe provides certain helper methods that you might need, and it may help you progress further through a problem than you normally would be able to speak up data structures.

  • Hash maps is another one that you have to know.

  • Many algorithms can be solved using hash maps.

  • It's a simple trick and give you a little secret here if you happen to get stuck on the interview.

  • Question.

  • Started thinking about hash maps, stacks queues These basic Data's directors are probably going to be involved in any optimal solution.

  • Hash maps I use very commonly in any interview question, so you should definitely understand how to use them.

  • You should understand their time space analysis, and you should understand how to use them like given some language of your trace.

  • How do you create a hash map How'd you populate it?

  • Was this index for that?

  • And you should also be able to know how to create hash maps of other hash maps, hash maps, Keith on strings, integers or even objects where you may need to compute a hashing function and be able to answer to interview.

  • If they ask you what that has shamed function.

  • Maybe one comment interview question with hash maps is to somewhere.

  • Given an array of indicators.

  • Find to indigenous that sum up to some number and using hash maps.

  • You can go through the array in one pass and figure out which two numbers sum up to some number.

  • Um, and that's another thing to keep in mind is how many passes you might need, like oftentimes in our greater might require one pass to process data in some way and then the second pass to actually compute the solution.

  • So keep that in mind.

  • Sometimes you may need to do to passes or even three passes that's still going to come as a linear time ever them, because you're still doing a constant number of linear time passes.

  • When I used to do interviews, I would answer them in PHP because I thought that that was a very quick language, and I still might use that sometimes.

  • But I've decided to also at sea or C plus plus to my language mixed because sometimes I get questions that can only be answered using C or C plus.

  • Plus, these are questions like rivers that link lives.

  • Since PHP doesn't really use pointers, it just doesn't work very well for the questions.

  • So be prepared to have C or C plus plus at your language disposal.

  • In case you get asked to do something like reverse a link list, you're going to want to be able to bust out those pointers for a question like that, or you can just use pseudo code.

  • But pointers are generally one aspect of computer programming that trips a lot of people up.

  • Interviewers might just ask you that just to see if they can catch it that way.

  • Sorting is another area that you should study up on, especially the runtime analysis of it.

  • In practice, people probably won't actually asked you to implement any of these in detail, especially the complicate the ones like, say, quick sort.

  • I think some of these are good to know, like, say, bubble sort or merge sort, but the rest.

  • If you have extra time and band with, then go ahead and study upon those, though, if you like.

  • And then the final tip is to know how to work with strings in your language of choice.

  • I know how to construct them, know how to read through them character by character.

  • You don't have to solve some common algorithms, like determined if the string is a palindrome or in the anagram.

  • Now, one area we haven't talked about too much is dynamic programming.

  • And I think that that night Mick programming scares a lot of people because often is an ah ha moment where you either get the algorithm or you don't.

  • And if you got it, then you can solve it very quickly.

  • And if you didn't, then it would take a really long time.

  • So my opinion, you should know the basics of dynamic programming.

  • But don't waste too much time studying it, because I would be surprised if the interviewer work to actually ask you out dynamic programming question like I think those are really pretty tricky and people are generally discouraged from asking questions are too tricky or too involved, but many times dynamic programming.

  • All it is is memorization where you're cashing the values as you're going through the algorithm, and just by cashing the values, you're solving some problems as you go through.

  • And then you can reuse the results of those problems to compute the final answer.

  • So as far as that goes, if you keep in mind cashing and solving smaller problems and then cashing those and reusing that valley, that's pretty much dynamic programming for you.

  • So those are my overall tips.

  • But I want to remind you once more that solving the problem itself is not the goal.

  • It's really the process.

  • By process, I mean is going to be in your analysis of the problem.

  • How well can you analyze it?

  • How well can you look at the design alternatives, trade offs, pros and cons in terms of time and memory?

  • Big O time space and Alice is Oftentimes there's many ways to self problem is going to be a trade off between time and memory.

  • And if you could just bring that out and mention like, well, if you want the optimize for time, or we're going to want to use this day destructor and solve it this way.

  • If you want to optimize for memory, we're going to do it this other way.

  • For example, you may be able to find an optimal time out over them using some hash map, but then you're using a lot of space, but would have been great if you could point out What if you want to be space efficient but not necessarily time efficient, that you could use some other algorithm does maybe quadratic time but doesn't use that hash map.

  • That would be great to show.

  • Similarly, if doesn't recursive algorithm point out the pros and cons of using that versus unedited algorithm.

  • Now I have one more tip for you, and it is in this bucks.

  • What's this brilliant or what?

  • This is amazing.

  • Brilliant artwork is an education, a website that can teach you officers of things, including computer science, fundamentals and algorithms.

  • And I'm a big fan of continued learning.

  • I even used the site myself to learn more about machine learning algorithms.

  • Their courses are done and they're really beautiful and interactive.

  • Wait that make learning a lot of fun.

  • And there's a broad range of other fun topics on here, too, including logic, math, science, physics, astronomy.

  • A lot of their content is free and very high quality, so you can browse around their website for hours, learning about topics that you may be interested in.

  • So to support tackle it and to learn more about brilliant, go to brilliant work, slash tech Lee and signed up for free.

  • And also the 1st 200 people that go to that link will get 20% off the annual premium subscription.

  • I'll do it for me.

Hi, I'm the Tech Lee.

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

B1 中級

編碼面試的頂級算法(軟件工程師專用) (Top Algorithms for the Coding Interview (for software engineers))

  • 2 0
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字