In a data scientist interview, should I use Python or C++ for algorithm/data structure questions?
-
I am used to Software Engineering Interviews where the typical language is C++/Java. I've always used C++. But I am now preparing for Data Scientist interviews, and the main everyday language there is Python. So, in these interviews, when you're asked typical whiteboard coding questions (Linked Lists, Trees etc.), should we code them in Python? Is that required (and/or accepted)? What's the language most commonly used?
-
Answer:
For algorithm / data structure questions, I would recommend just coding it up in whatever language you're most comfortable with. An engineer will likely conduct your algorithm / data structure interview anyway. You should be optimizing for the best quality solution. If you're more comfortable with C++ then stick with it!
William Chen at Quora Visit the source
Other answers
For a data scientist interview, you should be ready to write code in Python, especially if you list it on your resume. For algorithms and data structure questions the language often doesn't matter too much, but for data manipulation the overhead can turn what's supposed to be a quick 5-minute check that you know what you're doing into a half-hour slog that puts off the interviewer. Consider how much C++ you would have to write to do something like find the row with the largest sum in a tsv given the filename. I'll often ask a question like this in a data science interview just to check that the person can code. In Python, this is a fairly quick one-liner: max(open(fn), key=lambda row: sum(map(int, row.split()))) It can be a little longer if you're not as experienced with Python, but in Java or C++ it becomes a horrible mess of file I/O and string parsing and takes up a lot of the interview time. Very few people who use C++ in interviews are able to come out if this type of question looking positive. At the very least, I'll wonder why they would choose such a language to answer this type of question. For the more typical algorithms and data structure questions, go ahead and switch back to C++. Data scientists are always switching between scripting and more heavy duty languages, so this will either be ignored or seen as a positive. You can probably get through most of your interviews just sticking with C++.
Dave Buchfuhrer
What's the language most commonly used? Short answer: Python. Long answer: you're asking the wrong question. People running whiteboard coding interviews generally don't care what language you use, they want to understand your thought processes, not your knowledge of a particular language's syntax. So use the language that comes easiest, because that will focus the interview on the important stuff. If you really think the interviewer is going to care a lot about language syntax, then the machiavellian solution is to use the language with which the interviewer is least familiar. So, I would recommend C# for an interview at Google and Go for an interview at Microsoft...
David Cleal
I can't possibly imagine that any company would care that you did it in C++ vs Python. In practice Python is probably better, but I think they would care more that you write clean code. Usually it's easy to believe that someone who writes strong code in one language can write strong code in another.
Sanjay Doraiswamy
Generally, you should use Python for data scientist interviews. I learned this the hard way. C++ is for creating high-quality, reusable code. Python is for getting stuff done fast (see caveat below). Unless you are as fast with C++ as you are with Python, you'd better stick with the latter. They really just want to see that you can answer the question quickly, not create elegant code. My ExperienceI was once given a take-home, timed programming assignment for a data scientist position and told I could use any language I wanted. When I told them I was going to use C++, they replied "Um.....well, okay. Are you sure you want to use that?" I guess that should have been my clue to make a different choice, but I figured I'd impress them with my software engineering knowledge. Dumb, arrogant mistake. CaveatI'm well aware that one can create high-quality, reusable code in Python and R (see The http://www.nostarch.com/artofr.htm for how to do software engineering with the latter).
Mark Meloon
Python is better for expressing ideas, ideal for discussions in a whiteboard. Less syntax clutter, more english-like language. And it is a lingua franca among data scientists. C++ and Java are more familiar to software engineers, and R is more familiar to statisticians. But everyone can understand Python, to some degree at least.
Charles Forbin
Related Q & A:
- How do I use WordNet in Python?Best solution by Stack Overflow
- How Can I use .net dll in C program?Best solution by Stack Overflow
- Can I use ajax to call c#?Best solution by Stack Overflow
- What questions do they ask at a Sears job interview?Best solution by Yahoo! Answers
- What kinds of questions do they ask at a home depot interview?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.