
Ask HN: How can a self taught developer learn Computer Science fundamentals? - rahilsondhi
I'm a 23 year old self taught developer. I have a business undergrad degree and I've been making websites since age 10. I'm mostly proficient with Ruby and JavaScript.  My last job was as a full stack developer working on the following stack: Rails, RSpec, Backbone.js, CoffeeScript, Heroku, Postgres, Redis, Sidekiq, Pusher.<p>I'm applying to software engineering jobs right now and I have the following questions for the HN community:<p>1) How can I do better in technical interviews where they ask me CS questions? What have other people done in this situation?<p>2) Are CS fundamentals really important in the real world? Does it depend on the position? What if you're a JavaScript engineer working with Backbone, browser performance, etc.<p>3) Recommended courses (online or offline) to learn CS?<p>Right now I'm reading Introduction to Algorithms by Cormen et al.<p>Example interview questions:<p>* Given an array of negative and positive numbers (eg -100..100), find groups of two that sum to zero. Now find groups of three. Now find all groups.<p>* Implement a function that takes an integer n, and returns the number of 1's in the binary representation of n.<p>* Implement a function that takes takes 3 (x,y) coordinates which define the vertices of a triangle, and a 4th (x,y) coordinate, as inputs. Return true if the 4th point falls inside the triangle defined by the first 3 points; false otherwise.<p>* Write an extract_word_series() function that takes a string and returns a 2d nested array where the inner arrays are a group of contiguous words. Assume you have an is_word() function.<p>* Write a function in Ruby to do a binary search of an array.<p>* Google interview topics: big O notation, sorting, hashtables, trees, graphs
======
logical42
I am a 29 year old self-taught developer. Like you, my experience lies
primarily with ruby and javascript (though I have developed a habit of doing
project euler problems in clojure).

1) Practice. Glassdoor is an indispensable tool for this. For example, if
you're interviewing at Facebook, you can basically compile a list of the
algorithms that have been asked and practice that set, until you have it
completely down. Rehearse in front of peers, friends, pets, inanimate objects,
whatever. You can likely find a working solution to any of these problems on
stack.

2) Yeah, they are pretty important, but probably not to the degree that they
are emphasized in the interview process. For example, a common theme in
algorithm problems is finding a solution which works within a certain time
complexity (linear, log, etc). In practice this often reduces to the following
situation: You are doing some calculation which involves a bunch of nested
for-loops. Eliminate one of the inner for-loops.. or something to that effect.
So yeah, it's important practically. It becomes more important when you're
dealing with millions of records and terabytes of data, and an extra for-loop
could mean that your program effectively runs a month longer than it should.

3\. The only online course I took for CS stuff was a MIT open-courseware class
on Algorithms. Additionally, I highly recommend the book "Algorithms" by
Robert Sedgewick and Kevin Wayne.

------
beat
Depends. What problem are you trying to solve? If your problem is mere
employability, you've already solved that. Actual work experience with Rails
and a modern stack (with the added plus of a four year degree, albeit non-CS)
is enough for a massively buzzword-compliant resume. And with a business
degree and that kind of education, you might be better off focusing on the
business problem space rather than the programming space. Keep programming,
but be a real-problem expert. Frankly, people who speak both programming and
business adequately are more valuable than specialists who know one but not
the other, in many/most cases.

So you already have enough to choose your job. Missing a CS theory question in
an interview should not be the difference between pay-rent and no-pay-rent for
you.

Therefore, the reason to learn deeper CS theory is because you WANT to learn
it, because you find it interesting for its own sake, because you want to
master your craft. That's good, that's pride. In that case, study some well-
regarded algorithm/data structure books and other classics, do code katas
(google it), maybe even go back to school and get an MIS degree.

I'd also recommend learning languages. C in particular is important, because
it will teach you how memory is managed. If you've never had to manage it
manually, there are a lot of things you don't understand. This doesn't mean I
recommend manual memory management (geez, if ANYTHING invites automation, it's
memory management!), but it's good to understand how and why.

------
KingMob
There's a lot of good advice in this thread, and I would suggest studying much
of this for your own edification. Cultivate curiosity!

That being said, the software industry has a bit of a fetish for giving these
problems in interviews, even though they're rarely used in your job, and
there's little evidence that performance on these problems is the best way to
evaluate candidates.

If you want to be a smart-ass after the interview, study up on Bayes' Law, and
lecture your interviewer about it. I.e., p(good programmer|pass interview
puzzles) != p(pass interview puzzles|good programmer). If you hire someone
because they did well on these problems, you later have data on how well they
do at the company. However, you will _lack_ data on how well someone does at
the company if they _don't_ do well on the problems (it could be they do just
as well), so you have no evidence it's good at classifying candidates.

In particular, while I think interview problems are reasonably correlated with
talent, I'm not convinced that they're a higher quality source of information
than things like whiteboard exercises, real coding exercises, and code
samples. It's also biased by things like recency (was your algorithms class
last year?) and cramming (be sure to go through Cracking the Coding Interview
exercises).

~~~
KingMob
One last thing, I enjoy these puzzles more than most, but I find it curious
that an industry as data-driven as computing has never systematically
evaluated its hiring procedures.

I suspect it's because only the largest companies could risk running two types
of interviews, one with puzzles and one without, hiring equally from both, and
then look at the data later. Even there, though they could absorb the hit, if
they're wrong, they'll have made a bunch of low-quality hires...

------
eterpstra
I've got pretty much the same credentials as you, and have been doing the same
thing over the past two years - getting better at programming.

Your most important asset right now is time. It looks like you have the
desire, so all you need is time to read books and practice. And then practice
some more. And then keep practicing.

I've enjoyed this website tremendously: <http://codingforinterviews.com/>

Every couple weeks you get an email packed with sample interview questions,
advice, and practice problems. Go sign up for it. (I am not affiliated with it
in any way, just a fan).

Also, for Javascript, one of the most useful/difficult topics I've struggled
with is Regular Expressions. Take a look at
<http://regex.learncodethehardway.org/book/> if you haven't already.

------
cadalac
I'd recommend the Discrete Mathematics course from the NPTEL.

[http://www.youtube.com/watch?v=xlUFkMKSB3Y&list=PL0862D1A947...](http://www.youtube.com/watch?v=xlUFkMKSB3Y&list=PL0862D1A947252D20&index=1)

Also check out their other CS videos.

[http://nptel.iitm.ac.in/courses.php?disciplineId=106](http://nptel.iitm.ac.in/courses.php?disciplineId=106)

Finally, put Youtube in HTML5 mode so you can increase the play speed if
needed.

------
scottbartell
I'm in a VERY similar situation. Self taught 23 year old developer with a BS
in business/marketing, Front End + Ruby experience, and interviewing for
software engineering jobs.

Prior to my first technical interview I spent tons of time studying algorithms
and data structures. Looking back I feel that my time would have been better
spent selecting several sample questions (such as the ones you included) and
solving them on a whiteboard over and over again (and checking and improving
them along the way).

For questions check out careercup.com, glassdoor.com, project euler, and the
Cracking the Coding Interview book: [http://www.amazon.com/Cracking-Coding-
Interview-Programming-...](http://www.amazon.com/Cracking-Coding-Interview-
Programming-Questions/dp/098478280X)

The more practice you have, the faster you will be able to: recognize what
type of problem a particular question is, come to an initial solution, and
improve upon that solution.

Feel free to reach out to me with any questions! (contact info in my profile)

------
darrelld
1) What do you mean by fundamentals? If you've been programming for a few
years you probably already have the fundamentals of programming down
(variables, functions, callbacks, loops etc). Rather it sounds like you need
to be prepped some more advanced problems that show a higher level of thinking
(sorting, searching, optimizing, data structures etc). I would recommend a
good algorithms book and a good data structures book. The Algorithms book
you're reading sounds good. Some programmers who got the "fundamentals" in
school will still pick up a book and go over those types of problems when
prepping for interviews. Don't forget to practice working problems out on a
whiteboard out loud.

2)Are they important? Yes and No. Will you use your knowledge ofdata
structures and algorithms everyday? For most jobs the answer tends to be no.
Will it help you overall be an efficient developer? Absolutely.

3) There are so many, Khan Academy and Coursera are quite good I think, give
them a shot.

~~~
lanna
He said Computer Science fundamentals, not programming fundamentals. If you
don't know the difference between Computer Science and programming, maybe you
should learn some Computer Science yourself.

------
kostarelo
well to be honest with you.

1) How do you expect to do better when they ll ask you something that you
don't have a clue what it is?? My answer is you CAN't

2) Recently i heard an exact same story. The guy was a realy passionate
developer, NOT good BUT passionate. He went on a public college and got his
deegree in 4 years. He's now a professional developer.

There is a nice maxim l really like. I think it's Japanese, not sure though.
It says: "Theory without practice equals wasted time. Practice without theory
equals wasted toil." So to answer your question it's VERY REALLY important. It
certenly depend on your salary! Do you really want to be 50 yo and still
writing Ruby? I really don't!

Reading all by your self stuff that students are tougt in third year on a
college.. it's going to be a pain in the ass.

To sum up i really believe that you are still young and you can do a lot. Go
find some good teacher, either online or in a college. Get a degree. Your eyes
will be WIDE open then. Thing's you have never thought will outpouring in
front of your eyes.

Best Regards, KB

------
samfisher83
Here is a list of facebook questions I compiled:
[http://letschat.info/reduced-list-of-facebook-
questions&#x2F](http://letschat.info/reduced-list-of-facebook-questions&#x2F);

Or just read CLRS. That is like the definite book of algorithms. I bet like
ever CS student has that book.

------
rdouble
The latest Sedgewick is better than Cormen for self study. Especially if the
goal is to get through a tech interview.

------
m0nastic
People's answers to whether or not you need to learn CS fundamentals have a
habit of being self-rationalizations, so be careful with what advice you take
(I say as I'm about to give advice).

How useful things are in "the real world" varies greatly. The consensus seems
to be that a lot of people say they go through their whole careers without
ever using any of the things you learn in CS (for example, you'll hear a lot
of "I've not once ever had to implement quicksort"). I don't doubt that these
people are correct, it seems pretty apparent that you can certainly have a go
at being a developer without knowing all the fundamental theory.

Some people seem to take this as a point of pride, however; like knowing those
things would be a drag and a waste of time. I find this attitude perplexing,
although I'll admit that it might just be a flaw in my wiring.

I want to know EVERYTHING. Literally, I want to know everything. This can't
happen, obviously (both for reasons around the limits of time, and also my
intellectual failings), so I try and prioritize.

If you decide that you really do want to learn all the fundamental stuff, I'm
sure people will suggest all sorts of ways that they've been able to do so.
Pick and chose the things that people say that seem appropriate to your case,
but obviously, everyone learns things differently, so don't expect there to be
a good foolproof path you can take.

What I've been doing (and keep in mind, I'm an idiot, although I hope slightly
less of one every day), is really a brute-force approach.

First, I looked at the curriculum at a bunch of well-regarded CS undergraduate
programs (I picked MIT and Stanford, mostly because in addition to being
pretty well-regarded, both have a lot of material online). I looked at what
their early intro CS classes looked like, what books they used, what the
lectures looked like, etc.

For books and topics which overlap between schools, that's an easy choice as
to what materials to use (for instance, it seems like almost everyone uses
CLRS for algorithms, so you can pick that one and at least feel comfort
knowing you're in good company. I actually used CLRS in school, so this second
time around I picked up Skiena's algorithms book ((mentioned effusively by
tptacek on here a number of times)) and have been going through that.

If you literally just pick out the books from the undergrad classes at a
couple of good CS schools and read them completely (and do all the exercises),
you'll be a good part of the way there. That's not to say you get the same
experience as being there (you don't), but presumably taking four years to go
enroll in an undergrad program isn't on the table as an option, so you're
making due the best you can.

And yes, the real knowledge will come from actually using the stuff you learn
in the books, so the whole time, be writing programs ("ABC"...Always
Be...Computing).

After the third or fourth "level" of classes, is usually the time in undergrad
where you then start to specialize. After the core curriculum, you'll find
that not everyone takes every class, you just have some number of classes from
the "CS bucket" that you have to take, and you pick from it based on schedule
and interest. Here is where you have an advantage over people actually in
school, however. You don't also have to be taking philosophy (although maybe
you should, again, in my case I want to know everything, of which philosophy
is a definite subset), so you can spend as much time learning as many things
as you want.

Want to learn about compilers? Read a book and build the projects. Graphics?
Networking, Functional programming (assuming the intro books were
predominantly imperative), whatever you want.

Basically, learn as much and from as many topics as you want to.

That won't help you in the short term ace programming job interview questions
(and to be honest, I'm not sure if anything can really be that helpful as a
short-term solution).

Again, I want to reiterate, you can have a long and successful career as a
software developer doing none of these things, but the one thing I'd say is
that once you do have a good grasp of actual CS fundamentals, you'll probably
be surprised by how much easier it is to solve problems. Not that those
problems are unsolvable without it, but that they are much more easily solved
(and in some cases able to be avoided completely).

------
lanna
> How can I do better in technical interviews where they ask me CS questions?
> What have other people done in this situation?

Go to a good University.

------
thesmileyone
Why do you need CS fundamentals if you are applying for a role which suits
your background?

------
jweather
Project Euler and NAND2Tetris are two good places to start.

