4
$\begingroup$

I have a PhD in computer science (A fresh graduate). My bachelor's major is similar to CS but without algorithms (It's a discipline between business and CS).

I am quite good at AI research but my coding skills are not that good. I lost two AI research job offers, from Google and Amazon, because of my coding tests. All the other interviews were very good (as the HR staff told me).

How can I practice/learn algorithm coding and improve it? Is there a platform or a course that will help me with this?

Just to give you some intuition about my level. For instance, I know how the recursion function works, and I can solve basic problems, but when I face a new problem I find it hard to be solved.

$\endgroup$
2
  • 2
    $\begingroup$ There's a difference between learning algorithms in the context of CS theory and "hands on" algorithms necessary to pass job interviews. For example, learning a bunch of NP-reductions, compiler optimizations and FFT is great for the first category but basically useless for the second, which is more about utilizing basic data structures. Then there's competitive coding, which is sort of its own thing... maybe more pertinent to job interviews but not necessarily. So, just to clarify, you're interested in algorithm skills for interviews? $\endgroup$
    – ggorlen
    May 5 at 17:15
  • 1
    $\begingroup$ @ggorlen I agree with you! yes exactly for interviews. $\endgroup$
    – Minions
    May 5 at 17:18

5 Answers 5

4
$\begingroup$

Find a project and chase it down, bit by bit. And keep it fun. If you aren't enjoying the process you won't keep at it. Depending on disposition I would suggest an arcade style game, a machine learning project, or maybe picking up a micro controller and delving into physical computing. In general though, the more time you spend coding the more confident you will be during those interview tasks. He is a list of stuff to get you started in no particular order.

Games - Having fun building skills

  1. Cargobot - This is a silly little game in iOS, where you use program blocks to move a loading robot around. The hook is that the programs you develop lean heavily into recursion.
  2. Human Resource Machine and 7 Billion Humans. Two more silly iOS games. These two focus on low level coding with 7 Billion Humans encouraging though in parallel processing.

Books - Digging Deep

  1. Algorithms in... a series of books by Robert Sedgewick that detail... well... algorithms. I have the C++ version on my shelf and page through it now and again when I want to make my head hurt. If you have the time it is good practice to flip to a page at random and attempt to implement the algorithm listed.
  2. Hitchhikers Guide to Programming Languages / Competitive Programming 3. Nothing like a good programming competition to get you thinking about how to improve your code. Both of these books discuss algorithms that pop up regularly at collegiate programming competitions. It is a great way to get a sampling of practical applications of algorithms.

Websites - Practice, Practice, Practice

  1. Codingbat.com - a website specifically designed to help people pass the coding challenges on job interviews
  2. ProjectEuler.net - Problem solving in the extreme. Every problem produces a single number as the solution. Some you can do in your head, some may require a spread sheet, some require serious computational thinking.
  3. open.Kattis.com - An active competition server with problems ranging from Hello World to How the Hell do you do that.
  4. CodeWars.com - How fast can you solve the problems. Pitting speed and creativity against others in live contests. The best part is that you can share you solution when each contest is done.

It is worth saying again: Find a project, something fun, and chase it down. It will keep you going, and give you something to brag about during interviews.

Good luck.

$\endgroup$
0
3
$\begingroup$

The way to learn something is to practice it. It is no different from yourself. Get a good book on algorithms, maybe one that is Python Specific or one more general. I've always liked David Gries' The Science of Programming, though it isn't strictly an algorithms book. But it has lots of exercises on algorithmic thinking.

But the key is to do all of the exercises in the book. If the book doesn't have lots of exercises then get a different one.

The classic book is Data Structures and Algorithms by Aho, Hopcroft, and Ullman, though it is a bit old now.

Neither of those is Python specific, which could be a good thing.

If you have a trusted colleague you might get them to look at and comment on some of your solutions. That feedback can be very valuable.

$\endgroup$
0
2
$\begingroup$

It seems that you are a good researcher, but you have applied to the companies where the top most priority is coding. The first thing is the Object Oriented Programming and Data Structures. I have heard that google provides you some problems and then you need to do some code to solve it. Your code should be neat and clean and time efficient.

Now, as you are applying as a PhD candidate, but you did not mention your test experience.

But to gain experience in coding you need to pick a pen and paper. Pick any data structure and algorithms book and practice problems mentioned there. I advise you to do practice in Python as this will also help you in AI.

As you are doing research in AI then start paraticing Keras (Python Library) also this will help you to know OOPS concept very well.

$\endgroup$
0
1
$\begingroup$

Computer science as practiced in an industrial setting is usually applied computer science. Outputs are typically products that consist largely of software, but may also involve hardware, documentation, publications, and patents. That means that pure computer science is enriched with elements of software engineering (an engineering discipline) and programming (a craft). As with other crafts, one becomes more proficient by practice, especially when doing so with guidance from a more senior practitioner, e.g. via code review.

Typical discoveries when transitioning from theory to working code are "integers are not unbounded" and "floating-point arithmetic is not math", plus how many different ways one can commit off-by-one errors. An interesting account of one such exercise is given by R. Lesuisse, "Some lessons drawn from the history of the binary search algorithm", The Computer Journal, Vol. 26, No. 2, 1983, pp. 154-163 (online):

Then, the important errors found in the 26 published algorithms are pointed out, with an attempt at discussing why these errors were made.

One modern way to practice the craft of programming is to provide answers to questions posed on our companion site Stackoverflow, especially when they include concise self-contained code with a test scaffold. This is one way how I as a retired software engineer with a CS degree try too keep my skills fresh. I highly recommend lurking on the site for a few weeks prior to writing a first answer to develop a feel for what are considered good and poor answers in this specific context.

Interview questions in an industrial setting that involve programming often use simple algorithmic concepts and simple data structures such tables, arrays, linked lists, or bit manipulation of integers. They are designed to be solved in a relatively brief amount of time, and besides testing basic algorithmic understanding tend to check whether an interviewee demonstrates reasonable fluency in the language of implementation. A starter question may be a simple as an implementation of FizzBuzz, of which stories circulate that it trips up a fair number of candidates. If they are posed in an interactive setting, the questions may also be designed to assess how a candidate reacts to hints and guidance by the interviewer and allow on-the-fly adjustments to the degree of difficulty.

Interview question therefore frequently differ from questions posed in classical algorithm (text) books, and are covered by specialized publications such as Gayle Laakmann, Cracking the Coding Interview or Adnan Aziz and Amit Prakash, Algorithms for Interviews.

But working out answers to text book questions can help gain proficiency. When I studied CS in the 1980s, a starting point was provided by Niklaus Wirth's two books Systematic Programming and Algorithms + Data Structures = Programs, followed up by Aho, Hopcraft, Ullman The Design and Analysis of Computer Programs, David Gries The Science of Programming, and Jon Bentley's Programming Pearls. Of these, the books by Bentley and Wirth are closest to what one is likely to encounter in a programming interview. The book by Gries is mostly about constructing correct programs and probably the least helpful in the present context. However, all of them are showing their age four decades after first publication. My recommendation for a modern work would be Steven S. Skiena The Algorithm Design Manual, 2nd ed..

$\endgroup$
0
1
$\begingroup$

As it is famous among programmers practice is the only key first of all you should know some common algorithms which are handy when we solve problems and interview

important-type-of-algorithms

then you should also sorting-algorithms you don't need to practice all you can google most common sorting algos

now comes the real beast linked list, arrays trees and other Data Structures

to practice and learn them follwing resources are best known:

https://neetcode.io/

https://leetcode.com/

https://www.hackerrank.com/

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.