The software development final exam: Algorithms and Data Structures - <AUTHOR> http://www.daemonology.net/blog/2012-10-08-software-development-final-exam-part-1.html <comment><USER3> _If you can't answer the majority of the questions...you're lucky enough to be working within a narrow area where your deficit doesn't matter._

Where by "narrow" one presumably means "narrow in theoretical scope, but extremely large in terms of number of people, number of customers, number of paid hours spent working on things, and amount of impact on the world". Most of the web was built by people who don't know what B-trees are.

How do these people succeed as much as they do? Because the folks who designed PostgreSQL _do_ understand what B-trees are, and they have been very successful at their goal: To encapsulate that knowledge in an abstracted system that other people can learn to drive without entirely understanding how it works.

This is not a problem with the web developers, nor is it a problem with this exam, which at first glance looks reasonable – people with CS degrees should be able to answer these questions. It is, perhaps, a problem with the concept of "software developer": It's being asked to cover too big a range. If the automotive industry were like computing, we'd use the phrase "auto mechanic" to refer to an amateur with a Haynes guide, a Midas Muffler employee, a member of a NASCAR pit crew, a Formula One driver, a mechanical engineer at Tesla Motors, an organic chemist working at a tire company, and Kiichiro Toyoda.

<comment><USER4> _Most of the web was built by people who don't know what B-trees are._

By number of sites, perhaps. By revenue, I don't think so. The big names that dominated what the web is to most people certainly do know this stuff, at least insofar as the practical implications, and they try not to hire people that don't for development roles. That isn't to say that they don't also just use Postgres (or Berkeley DB, or whatever) instead of writing their own.

 _If the automotive industry were like computing, we'd use the phrase "auto mechanic" to refer to..._

I totally agree with this - the field could use a few more job titles (and a little less grade inflation - SENIOR software engineer on 2 years experience? Really?) Software Fitter would be a much better description for the skilled assembly role that a lot of modern software boils down to. CRUD Technician is going to to need some PR work though!

<comment><USER5> >>By number of sites, perhaps. By revenue, I don't think so.

>>Software Fitter would be a much better description for the skilled assembly role that a lot of modern software boils down to. CRUD Technician is going to to need some PR work though!

I don't know why intelligent people with a little knowledge automatically think they are going to be rich. This causes a lot of heart burn and pain to people in later parts of their lives when they figure out things don't work that way in the real world.

Regardless of whatever you may think about them. You may even think them undeserving of all the money they earn, you may think they are stupid. The fact is abstraction enables people to work with a lot of things without knowing much about them in detail. In fact abstractions are invented for that very purpose. So that a million people shouldn't waste their time, energy and effort to relearn things, when all their resources can be better utilized to know just the abstract details and build things on top of it. This enables people to build things quickly on what is already available.

Revenues, money et al are dictated by what the world considers valuable at any time. You might know 1000 algorithms from the book, you might have studied every other data structure that's out there. But if knowing how to write a SQL query is what is valuable in the economy right now, guys doing that are likely to be paid more than you.

This isn't surprising at all. As developers we enjoy a unique position in the market. As for the money we get, compare this with any other industry, our peers working there get paid well less. How is is possible that people who work at the same level of difficult as we do get paid less than us? Because- merely knowing things and difficulty of tasks doesn't qualify for a better compensation.

</comment></comment></comment><comment><USER6> I have a CS degree from a respectable CS department. I got straight A's in my major and never crammed for a CS test. I am sure I could have answered these questions in 1997. Today, I can answer the first two questions. I think I can get partial credit on the third. I believe I knew the fourth once. I don't even remember what bipartite means [see edit below]. And that's with having implemented a topological sort within the last few years.

I would like to believe that if I came across a problem where knowing this material would help solve the problem, some part of my brain would activate and put me in the position of "Oh, I know I don't know this anymore" and I'd go look it up. Vs "not knowing what I don't know" and just bumbling along ignorantly.

I guess this is a long-winded way of saying I'm glad to have a CS degree and I think it puts me a leg up over software developers who haven't studied CS, but I'm still not sure how applicable these questions are to most developers.

Edit: On most exams I've taken, the fifth question would have been asked like this: _A bipartite graph is a graph whose vertices can be divided into two disjoint sets U and V such that every edge connects a vertex in U to one in V; i.e. U and V are each independent sets. Equivalently, a bipartite graph is a graph that does not contain any odd-length cycles. Describe an algorithm that determines if a graph is bipartite._

<comment><USER7> Frankly, asking the question either way is what I would call prejudicial. What is a scenario in which bipartite graphs occur, and why not ask how _that_ would be dealt with?

<comment><USER8> Any n-dimensional grid (sometimes called a "Manhattan space") is a bipartite graph. You may find it useful that no odd-length cycles can exist in such a graph.

<comment><USER7> What is a practical scenario for odd-length cycles in a grid?

<comment><USER8> Ah, sorry, the odd-length cycle was supposed to be a hint for Colin's problem, not an actual use of bipartite graphs.

I find all the uses of bipartite graphs to be in maximal matching or similar situations.

<comment><USER7> Still..."scenario."

<comment><USER8> There are many reasons why you would want a maximal matching. In my case I was working on a distributed system prototype that needed to match block requests my users to cache servers. This is a maximal matching from cache servers who have these blocks available to users requesting blocks.

</comment></comment></comment></comment></comment></comment></comment><comment><USER9> While I can answer some of these questions (and could answer them all a few years ago while attending university) this kind of knowledge is simply not something that I use on a daily basis. I also doubt that many others developers use it unless they have very specialized jobs.

These kind of questions should not be the only basis of the software development final exam. In software development problem solving, communication with others, knowledge of the tools etc. are much more important than knowing random knowledge about algorithms. And these skills are much harder to test than asking the worst-case run time of quicksort.

<comment><USER10> Yes, this is CompSci, not software engineering

<comment><USER11> Then perhaps the author shouldn't be presenting them as practical issues, and claim that people who don't know the answers either shouldn't be programmers, or work in some tiny niche. You read the context article he linked to, right?

<comment><USER12> Just to get the facts straight, the linked article had this to say:

 _If you can't answer the majority of the questions on these four papers, and you're working or intend to work as a software developer, you should ask yourself why — most likely you're either you're missing something you really should know, or you're lucky enough to be working within a narrow area where your deficit doesn't matter._

The reader can judge for themselves whether this is claiming that "people who don't know the answers shouldn't be programmers." I personally find that characterization rather rude toward the author.

<comment><USER13> > or you're lucky enough to be working within a narrow area where your deficit > doesn't matter

This implies that non-algorithmic work is a narrow area. In my experience, it's the _vast_ majority.

<comment><USER14> I agree, non-algorithmic work is the vast majority of programming work today because most of it is related to Application Programming.

The reason for this is that most Application Programming emphasizes the use and sufficient knowledge of a framework, rather than a full understanding of CS fundamentals.

While those with CS have a head start in understanding frameworks quickly and utilizing them effectively, self-taught programmers can catch up rather quickly if the framework is well written and geared towards them. And fast majority of frameworks trend towards this.

Application programmers generally need to know the ins and outs of a framework and this knowledge often carries them further than the fundamentals.

All that being said, after 10 years of application programming, I'm slowly trying to re-learn much of my CS material out of my own personal interest and get off the framework treadmill. It's been a fun process to rediscover fundamentals after learning them over 10 years ago.

But let's be realistic about it, most app programmers have no interest in CS fundamentals or theory unless it has some direct context to their daily work.

<comment><USER7> Just as an anecdote from a self-taught, I few years ago I started in on GoF and got about 100 pages in before I came to the conclusion that a lot of what I'd read so far and was attempting to incorporate into my knowledgebase is already a part of the languages I'm currently using.

I know there's a use for these details, I want to learn them, but I suspect that many times the direct context is built-in, which is pretty much what you say about learning frameworks, which may be possible to consider as dialects of a language. In fact, by Googling I see that people have written about language subsets in the context of Lisp, so full-circle I go.

</comment></comment></comment></comment></comment></comment></comment><comment><USER15> _"If you can't answer the majority of the questions on these four papers, and you're working or intend to work as a software developer, you should ask yourself why — most likely you're either you're missing something you really should know, or you're lucky enough to be working within a narrow area where your deficit doesn't matter."_ [1]

I'm a self-taught front end web developer who didn't have a traditional computer science education. I'm looking to move into general software development, and I can't answer any of the questions on the first paper without cheating.

Can anyone recommend specific online courses or books for the four proposed papers[2] to fill the gaps in my knowledge without spending three years at Oxford?

[1]: From the original post at [http://www.daemonology.net/blog/2012-10-08-software- developm...](http://www.daemonology.net/blog/2012-10-08-software-development- final-exam.html)

[2]:

        1. Algorithms and Data Structures
        2. Computer Architecture and Operating Systems
        3. Mathematics
        4. Networking and Systems

<comment><AUTHOR> I haven't looked to see if every question is covered by these, but here's some standard textbooks I like:

Algorithms and Data Structures:

[http://www.amazon.ca/Introduction-Algorithms-Thomas-H- Cormen...](http://www.amazon.ca/Introduction-Algorithms-Thomas-H- Cormen/dp/0262033844)

[http://www.amazon.ca/Algorithms-4th-Robert- Sedgewick/dp/0321...](http://www.amazon.ca/Algorithms-4th-Robert- Sedgewick/dp/032157351X)

Computer Architecture and Operating Systems:

[http://www.amazon.ca/Computer-Architecture-Quantitative- John...](http://www.amazon.ca/Computer-Architecture-Quantitative-John- Hennessy/dp/012383872X)

[http://www.amazon.ca/Design-Implementation-FreeBSD- Operating...](http://www.amazon.ca/Design-Implementation-FreeBSD-Operating- System/dp/0201702452)

Mathematics:

<http://www.amazon.ca/Calculus-James-Stewart/dp/0495011606>

[http://www.amazon.ca/Introductory-Statistics-Prem-S- Mann/dp/...](http://www.amazon.ca/Introductory-Statistics-Prem-S- Mann/dp/0470444665)

[http://www.amazon.ca/Introduction-Mathematical- Cryptography-...](http://www.amazon.ca/Introduction-Mathematical-Cryptography- Jeffrey-Hoffstein/dp/0387779930)

Networking and Systems:

[http://www.amazon.ca/Computer-Networks-5th-Andrew- Tanenbaum/...](http://www.amazon.ca/Computer-Networks-5th-Andrew- Tanenbaum/dp/0132126958)

[http://www.amazon.ca/Database-Management-Systems-Raghu- Ramak...](http://www.amazon.ca/Database-Management-Systems-Raghu- Ramakrishnan/dp/0072465638)

[http://www.amazon.ca/Distributed-Systems-Principles- Andrew-T...](http://www.amazon.ca/Distributed-Systems-Principles-Andrew- Tanenbaum/dp/0130888931)

<comment><USER15> Thank you. I'll get reading!

Thanks also for proposing the test and posting the papers online. It's hard to discover what level of knowledge is assumed of software developers if you've never worked in a large team and haven't entered the field via graduate or postgraduate study.

<comment><AUTHOR> Yes, although I didn't get around to mentioning it in my introductory blog post, "self-taught" developers are part of why I'm doing this.

</comment></comment></comment></comment><comment><USER16> I'm not going to put judgement on this statement, but here is (what I'm fairly sure is) the truth: most people developing software (we're talking, not in silicon valley, or in the united states, but globally) need exactly none of this.

My current day job is working for the company that maintains and manages NZ's Company registry, as well as a dozen or so other registries over varying subjects.

My previous day jobs were in healthcare and various genres of insurance.

I have a BSc in CS. I have used, and this is the salient bit, _absolutely nothing of this complexity in my day jobs_. Ever. (personal projects are another matter, but I don't get paid for those)

Briefly:

\- Big O notation has never been relevant: performance is always improved by doing less IO, rethinking data structures or more complicated SQL queries, throwing more metal at it and occasionally actual profiling which finds out we're doing stupid things (not that those stupid things are ever Big O related).

\- Quicksort, who cares? I just do sorts in SQL or run Java's .sort() command (which does QS anyway), see above for perf concerns. I don't have to _know_ about it to use it.

\- Heapsort, who cares? Again, sort performance has never been a concern.

\- Never used graphs, the only "algorithm" I've ever had to professionally write was a Luhn check and I probably should have used a library for that anyway.

Again, I don't want to say whether or not this is a good or bad reality, but the point is, the _vast_ majority of people writing code professionally are basically writing the same app over and over again:

\- Build web page I can CRUD data with

\- Store data from that web form in a database

\- Modulo some bespoke business rules

\- Integrate with some 3rd party systems.

That's it.

<comment><USER17> I used to think so too, and yet...

\- My current team created a project that lets you run complicated, multi- dependency Java code in an non-blocking manner. Internally, the framework uses topological sorting of a graph of nodes, where each node is a method with potentially blocking code and the dependencies between the nodes are the edges of the graph. The framework is able to set up callbacks automatically in the right order given the above.

\- iOS6 auto-layouts internally use constraint solving on a set of linear equations so that you can write code to set the layout of your UI elements in terms of equations (so that you can basically just say that your button should be at 40px left of center of its superview, and with a 100px padding from the bottom).

\- I wrote code to improve the accuracy of models at my previous job by employing various machine learning algorithms (thanks Andrew Ng and Coursera).

These might be isolated examples, but my point is that some of the best code I have seen uses a lot of math and CS concepts (sometimes in clever ways).

<comment><USER7> Forgive me from asking from ignorance, but isn't the first point begging the question of complicated, multi-dependency code?

</comment></comment></comment><comment><USER18> Heap operations? Bipartite graph? Implementing these is _vanishingly_ rare. I'd wager no more than 0.1% of graduates who've seen these things ever have to maintain code that implements them, never mind writing them green field. And that comes from a guy who used to maintain a compiler.

You make a convincing case for your insularity IMHO :)

Now the didactic exercise of implementing a handful of data structures and algorithms like these from scratch has a lot of value. And knowing they exist, so you can look them up and find a library / implement if necessary, is also valuable. But knowing them 10+ years after college? The details are simply irrelevant; other things are more worth knowing off the top of your head.

<comment><USER19> It's not about being able to implement them, it's about understanding the implications. Yes, I can do arithmetic by reaching for a calculator, but if I had to use a calculator for every single blesséd piece of arithmetic, I would find it impossible to do any kind of significant algebra.

Having the basics immediately to hand, without having to look them up, is needed to move on to the next level. Knowing how to recognize a bipartite graph means that when there's one around you're likely to think - hmm, I wonder if that's bipartite? recognizing the problem to be solved sometimes requires that you have a deep and fundamental understanding of the types of solutions that exist.

People seem constantly to say this - I can look it up on Google, why do I need to know this? I constantly solve problems my colleagues can't (and _vice versa_ ) because I have a deep familiarity with a range of techniques that they can look up any time they want, but don't recognize "in the wild."

<comment><USER18> There is a difference between knowing what a meal tastes like, and how to cook it.

What you are arguing for is knowledge of what meals taste like (e.g. two primary taste dimensions being space and time). I think this is really useful; so I agree with you.

But what Colin (and I mean OP) is asking for is knowledge of how to cook two specific meals, themselves rarely asked for.

I personally think CS education is _mostly useless_. Big-O notation and a survey of the field (a taste test of the meals, if you will) are all you really need bring along with you from discrete math, in my very humble opinion.

Cooking some of the meals while learning will teach you the general skill of following a recipe; a few more applied challenges will develop your improvisation skills. But the more applied it gets, the less CS it is.

The field is too broad, IMHO, for deeper knowledge of only a handful of things to be very useful. I know a lot about hash tables, for example, but that's because they were very useful in my job, and critical for performance. It would be a waste of time for me to know as much as I know about them now, coming out of college, never mind 10+ years later. I wouldn't come down like a ton of bricks on a recent graduate for not being able to name 3 different collision resolution approaches off the top of his head, never mind someone 10+ years out; even for a job that required their use and impromptu implementation, as mine did.

<comment><USER20> Have you considered that it's teaching you a way to think outside of your normal range, so that you can comprehend and imagine more complex designs that are easier to build and maintain?

</comment></comment></comment></comment><comment><USER21> This is the interesting bit

"on each paper, at least four of the five questions relates directly to material I have needed to know during my time working on Tarsnap, "

Most software jobs are far more distant from CS that Colin's. And more power to him for working fulltime on something that leverages his knowledge. (spoken as someone who spent a decade doing glue-random-apis-together-and-bill -by- the-hour enterprise software scut work)

<comment><USER22> Yet, at least in the European countries I've lived in, you won't get through HR without a CS degree, unless you're doing your own business.

<comment><USER23> I'm in the UK, I know people who are _excellent_ developers who don't have degrees on any kind and who have no problems whatsoever getting employed.

Mind you they have 10+ years experience and can point to major succesful projects - so whether or not they have a degree or not is rather irrelevant.

<comment><USER22> In Portugal, Switzerland and Germany I never knew about the HR department accepting any candidate without CS degree or related field (e.g Electronics), in the companies I worked for.

<comment><USER24> I'm employed in Portugal without a (completed) CS degree, and I had more than one company to choose from. From what I could tell, the interviews were much more important than any lines on my CV.

<comment><USER22> I'm actually Portuguese, the only people I know that managed to do that, were guys and girls from my degree doing something on the side during the .com days for some startups, back in the 90's.

Never saw that in the big companies, but it's been several years that I don't work there.

<comment><USER24> Well, the only "big" company I interviewed for was Sybase, but they were interested (although, I think they mentioned that my salary would be affected by that).

I chose a smaller software company, though. I much rather earn less but have a less enterprise-y work environment.

</comment></comment></comment></comment></comment></comment></comment><comment><USER25> These questions have very little to do with software development as practiced by 99% of developers. They relate to computer science, a branch of mathematics with different concerns.

I've been developing software professionally for 23 years. I have a BSc in Computer Science [1] and an MSc in a computing-related field. And I have never needed to be able to answer questions like these to do my job. I have a vague understanding of big-O notation, and equally vague knowledge of the characteristics of various algorithms like heapsort, but thats all. If I need a sort algorithm then the framework or standard library provides a selection, all written by smarter people than me.

If you are developing a relational database or Google-scale distributed platform then, yes, you probably need to know this stuff. But most developers don't. I have to understand how to capture customer requirements, fit them into systems that already exist, estimate and implement them quickly and reliably, deal with the practical details of IIS or an RDBMS, maintain code, etc. I wonder if the author needs to get out more.

[1] Badly named, I learned little real comp sci.

</comment><comment><USER26> I'm seeing a lot of apologists for mediocrity here. They seem to be drawn out by articles like this one as well as articles about interviewing.

Despite the sentiment here, Colin is right: this is knowledge that developers ought to have. Not because they need it to do their day job, but because they _can't avoid learning these topics_ if they truly love the field.

Sure, you can earn a pretty decent paycheck hacking web apps and "enterprise" software without ever learning any of these things, and you may think, "This stuff is useless for most everyone." A friend of mine replied to that sentiment on Twitter: "If you manage a Taco Bell, I'm sure you feel a lot of the stuff in an MBA is useless for managers too." You can successfully bring in a paycheck programming without knowledge like this--just like you can successfully manage a Taco Bell without having an MBA--but you should not claim to excel in your field in either case.

Call me a snob if you will, but I don't want to work with mediocre programmers whose knowledge takes them only as far as the nearest web framework any more than I want to do business with the manager of my local Taco Bell. I want people with passion for our field, and those people _can't avoid_ gaining the kind of knowledge that Colin's test asks about.

<comment><USER27> > Call me a snob if you will, but I don't want to work with mediocre > programmers

> I want people with passion for our field, and those people can't avoid > gaining the kind of knowledge that Colin's test asks about.

Claiming to own the definition of passion is not snobbish but conceited.

Perhaps I consider programmers mediocre if they lack design experience and cannot show me how to setup custom guides in illustrator. "I want people with passion for our field" I don't simply want programmers who end at the compiled code, I want people who understand design, typography and color theory. A programmer who cannot do these things is mediocre at best.

Or maybe it is linux that is the bar. It doesn't make any sense for a programmer to use windows, only real programmers use linux. They should be able to install/configure openssh, tomcat, nginx, redis, mysql-server. They need to know bash inside and out, be able to create permissions, user groups and have a deep and thorough understanding of the kernel. If you are a windows programmer then I don't have time for you at my company where all we do all day is build awesome.

Perhaps it is mathematics. Algebra, calculus, trig, geometry. Statistics, analytics... I hope you have your TI-83 ready for this interview. As only the most mediocre of programmers will barely be able to survive in this industry without a MS in Applied Mathematics.

Hire who you want, base your interviews how you want you want. Just don't assume to be on the upper bar and beneath you lies mediocrity. That's all.

<comment><USER26> Your post is largely a straw man and contains snark that certainly does not raise the level of this conversation.

I'm talking about _passion for programming_. I'm not "claiming to own the definition of passion," I'm saying that passion _for programming_ manifests in knowing the answers to questions like Colin's. It simply does.

<comment><USER28> > contains snark that certainly does not raise the level of this conversation

Calling people that don't agree with you mediocre or apologists of mediocrity is just rude.

<comment><USER26> I did nothing of the sort.

</comment></comment></comment></comment></comment><comment><USER29> I'm self taught and I'm in two minds about this. In one way, these are fundamental questions and, yeah, we should at least know why they're important. However, I can't help feel the binary nature of the questions is a bit like asking a Computer Scientist "Which flag do you set on an Android Intent to make sure an activity only exists at the top of a history stack?" straight off the bat... It favors those who have prepared specifically for the question.

In any case, I guess I have a bit of reading to do..

</comment><comment><USER30> This is a less extreme way of saying that understanding Newtonian physics will make one a superior shooter in basketball.

Understanding CS theory is a way of testing intelligence, sure. But the author betrays his own lack of familiarity with the industry today in implying that it is required knowledge to be an effective developer.

</comment><comment><USER31> @cperciva - you're right, I can't answer those off the top of my head like I could 15 years ago when I studied it.

I don't think that's a problem with the exam system though; I could probably have answered them 12 years ago. It's just related to the field you end up in and how much you need to lean on that knowledge in your day to day job.

As it stands, given a couple of hours of reading, I'd easily be able to refresh my knowledge and answer the questions, primarily because I had a solid formal training in it initially. Ability-wise, the me of my uni days could _never_ do the job I'm doing now - well, not without another 15 years experience :)

<comment><AUTHOR> As I wrote in my introductory post, I _have_ needed to know most of these things in my day-to-day job. Of course, it depends on what sort of work you're doing.

<comment><USER32> I don't need to know these things in my day-to-day job either. However, if I _did_ need to know them, they'd be a Google search away, and I could find them out in less than a minute (less than the time it takes me to get urllib2 to send cookies, for example).

On the other hand, I imagine that someone who hasn't been formally trained in complexity would have a harder time, because they wouldn't be aware of basic concepts such as complexity, the O notation, etc. Therefore, asking whether someone knows what O(n) means strikes me as a better performance test than trivia like the difference between O(2^n) and O(3^n).

<comment><AUTHOR> _asking whether someone knows what O(n) means strikes me as a better performance test than trivia like the difference between O(2^n) and O(3^n)_

So far that's turning out to be one of the most useful questions, actually... but I wouldn't call it trivia.

<comment><USER32> Yeah, bad example there. The asymptotic running time of the heap operations, or quicksort runtimes, for example, though, were more like trivia, even though you can basically get them if you know the algorithms and reason about them a bit.

I know the running time of quicksort offhand, but I'd still consult wikipedia on the off chance I'm wrong.

</comment></comment></comment></comment></comment><comment><USER33> I have a CS degree and I am employed as an Application Developer.

To me these questions are daunting. Am I the only one here who feels like they have an inferior CS degree? Reading the comments in HN threads usually makes me feel a bit dumb, but this post in particular makes me feel like a lot of money has been thrown at a degree that did not teach me a lot about Computer Science.

</comment><comment><USER34> These questions test the students' familiarity of the basic CS topics taught during the previous year. It's a test on the subject matters of the CS courses. If you don't use some of these stuff over the years, you will forget about them. I forgot the properties of the bipartite graph and have to look them up.

This reminds me of those trigonometry proofs we learnt in high school. I remember I could go through those complicate trig proofs with ease back then. Now beside some basic sine/consine stuff due to work, I completely forgot about the rest of them since there wasn't a chance to use any of them.

Basic course level knowledge are good to learn. Just the test needs to be relevant and in context.

</comment><comment><USER35> A lot of these questions look great if you just finished school, but not so great 10 years later. There are an almost unlimited number of things I can focus on that will actually improve my performance on the job, and none of them are memorizing the workings of B-trees just in case I need to use one someday and the internet is down.

Computer Science degrees are about laying the foundations so that you can understand things like B-trees when you need them.

</comment><comment><USER36> First, since I took this class just a year ago, I can answer all of these questions. Will I be able to do so in two or three years? Probably not. Some things like heapsort already start to fade away in my mind. But if, even in 20 years, Ijust open Cormen et al. and take a brief look I will remember.

If you have passed the class in university and now feel bad that you can't answer these questions, don't worry. It does not matter. If you want to work at Google, work through Cormen again before the interview.

Feel free to pick your favourite field like Compilers or Machine Learning and put a basic question to the author of the quiz, when you meet him in person. If he can't answer, pat yourself on the back and feel free to consider yourself a better software developer.

</comment><comment><USER37> I love clever algorithms, and really enjoyed algorithm and data structure classes at university. However, despite having worked for over 20 years as a programmer in several software-intense companies (big and small) in the telecommunications and VoIP field, I have almost never had a need to know the answers to these questions.

In fact, it was the second biggest surprise for me when starting out as a programmer after university. I wrote this up in "Top 5 Surprises When Starting Out as a Software Developer" [http://henrikwarne.com/2012/08/22/top-5-surprises-when- start...](http://henrikwarne.com/2012/08/22/top-5-surprises-when-starting-out- as-a-software-developer/)

<comment><USER38> Did you ever need to write an algorithm to process some large volume of data, and you had to make choices related to performance, e.g. to avoid a combinatorial explosion in some searching problem which trivial implementation would be a full cartesian product of several dimensions of data (i.e. a bunch of deeply nested loops)?

Speaking of cartesian product, did you ever wrote a huge database query that you had to optimize through smart usage of join methods, indexing structure, caching (eg materialized views), decisions like subqueries versus joins versus procedural code etc.?

Did you ever had to pick a library collection -- not implement your own hashmap or tree, but just select the ideal implementation -- to allow optimal searches in a given dataset?

If answer='Y' to any of these, then you needed that knowledge, and I guess you do in a regular basis. The thing about CS theory is that it structures and formalizes these problems so they can be precisely analyzed; used as basis for further inventions and improvements; reliably predict the result of some design choice, etc. You have some empirical knowledge of things like computational complexity, but having _formal_ knowledge would often allow to replace hunches with objective certainty, or arrive to the optimal answer to some problems much quicker and more reliably.

At least that's the theory. ;-)

<comment><USER37> I absolutely agree that knowing basic CS is a good thing, and it will make you a better developer. Also, we do internalize a lot of the concepts so they become second nature. That being said, it surprised me how much code there is where this doesn't matter.

As for the specific questions: It's definitely good to know big O notation, so maybe I was a bit quick to dismiss the first question. However, a more realistic/useful comparison would be between O(n^2) and O(n log n).

For picking a collection to use – definitely knowing when to use a hash map versus a list. Asymptotic run-time behavior of Quicksort – no. Binary search tree – that's the one example I mentioned in my blog post, so yes, useful. Graphs – never needed in the applications I've worked with. Same for using a heap, never seen/needed.

<comment><USER38> Graphs are an interesting case in this debate. I agree that you very rarely run into real-world problems that look like a traveling salesman or bipartite test etc. But the thing about graphs is that they are the foundation of ALL data structures, and lots of algorithms. Lists, hashing, trees, arrays and more -- just special cases of graphs. If you can describe anything at all with a boxes-and-arrows diagram, it's a graph problem ;-) so if you know at least the core concepts of graphs, including some fundamental techniques (e.g. advantages of each representation such as adjacency matrix vs. node list vs. edge list), then you have the tools to work through any data structure problem; and any algorithm that's focused on searching or manipulation of specific data structures. And this can take you very, very far.

Once again, of course you can learn most of these foundational concepts more empirically, or in a more "bottom-up" way by starting with the standard data structures and algorithms that you use in practice, but gradually deducing general concepts that unify them. But I wonder if this can ever result in the same deep insight that some study of graph theory can give.

</comment></comment></comment></comment><comment><USER39> These questions are way too basic- the first 4 can be answered directly from the definition of each term, and there is no thinking involved. The 5th question can be answered with knowledge from 1 lesson in graph theory.

<comment><AUTHOR> I'm glad I'm not the only person who thinks these questions should be easy. Alas, evidence so far is that they aren't.

<comment><USER40> They're only easy if you know those definitions, which makes them trivia questions.

</comment></comment></comment><comment><USER41> I wanted to ask this question regarding big O notation. When we say f(n) = O(g(n)) all we mean to say is that f(n) <= c(g(n)) with other constraints. My question is, why do we have an equal to sign, why is f(n) equal to O(g(n)).. they could have made up a new symbol to establish such a relationship... The reason why I think so is because I see equal to as a transitive relationship.. So, if a = b and c = b, then a = c .. This clearly doesnt hold when we use f(n) = O(g(n)) .. n^2 = O(n^2) and n = O(n^2), so n = n^2 which is not making any sense..

<comment><USER42> _why is f(n) equal to O(g(n)).. they could have made up a new symbol to establish such a relationship..._

It is an equality relationship why would they need a new symbol?

 _f(n) = O(g(n)) .. n^2 = O(n^2) and n = O(n^2), so n = n^2 which is not making any sense_

You are right it doesn't make any sense. Try n^2 = O(Selection_sort(n)),O(Bubble_sort(n)) = O(Selection_sort(n)), n^2 = O(Bubble_sort(n)). Nice and transitive the way it should be.

<comment><USER43> It's not an equality relationship. If it was an equality relationship it would be transitive. But as your parent points out, you have n=O(n^2), n^2=O(n^2) but not n=n^2, so transitivity doesn't hold.

Another way to see that the relationship can't be equality: the left hand side is a function, the right hand side is a set of functions. Two things from different classes can't be equal.

The relationship is simply set membership.

<comment><USER42> Ah thanks, I misunderstood which part was being called in to question.

</comment></comment></comment></comment><comment><USER44> I'm self taught and working as a developer. I found these questions almost trivial, I'm genuinely surprised so many developers are having problems with them.

<comment><USER45> Whilst I agree with you on being self-taught and knowing those answers I will say that I finally went and got an MSc in Computer Science after 12 years working professionally as a developer and being self-taught.

Part of the reason was to find out what I didn't know.

What I didn't know was basically some parts of set theory and quite a chunk of automata theory.

I did find cperciva's questions to be trivial, but I wouldn't say that makes them trivial. A TV quiz once said, "It's easy when you know the answer.".

Algorithms for someone else might be what automata theory was to me.

<comment><USER44> I agree, you'll only know the answer if you've taken the time to learn about the specific concepts being tested.

I suppose what I'm surprised about is that a large number of developers haven't taken the time to learn (or have since forgotten) the theory around these particular concepts.

<comment><USER46> Life isn't a perpetual data structures class.

</comment></comment></comment></comment><comment><USER47> Colin -- it will probably shock you to learn that I, ostensibly wielding an honours degree in computer science -- failed algorithms.

(Remember our talk about impostor syndrome? _In my case it's actually true_.)

</comment><comment><USER48> I have no educational training in computer science, but I work as a software developer. I could not answer any of those questions, literally 0 out of 5.

1\. Is O(2^n) equal to O(3^n)? Why? I have absolutely no idea what that means.

But I did have to answer this question: why does the application crash? "Oh...that's because the developer that was pontificating yesterday about how heap operations behave asymptotically forgot to check if the database connection was open before he called the Save method. Apparently, such arcane trivia is beneath him. I can fix it."

<comment><USER49> from all the questions this is the one you MUST know if you want me (or anyone) to trust you with a piece of code. It takes one hour (in wikipedia!) to learn everything you'll need for a day-to-day work complexity assessment with the Big O notation.

They asked us this questions on our high school final exams, I'm sure you'll manage.

<comment><USER48> > O(2^n) equal to O(3^n)

Yep. So I looked into it and it seems they are not equal. Every f(n) in the set O(2^n) belongs to O(3^n). While this means that O(2^n) is a subset of O(3^n), we can see from the trival case f(n)=3^n that O(3^n) is not a subset O(2^n) since 3^n > 2^n for all n as n approaches infinity, or there is no k such that is exists an n0, such that all n > n0 implies 3^n < k*2^n, therefore the two sets are not equal.

Great. I still don't see how I am more qualified to do absolutely anything in life.

<comment><USER49> That's a great textbook summary, now for applications:

You got an array of your friends, an array of people who upvoted this post and an array of people who replied to this post. Filter all your friends who upvoted and replied to this post.

Now, before you write the code, how fast/slow will it run? for 1,000 friends? 1,000,000? will the runtime grow extremely fast? why?

Here's a Redis command that intersects two keys - <http://redis.io/commands/sinter> \- the complexity is "O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets." - do you understand why? do you understand when it will be fast and when will it be slow?

<comment><USER48> I'll give this a shot.

The code I would write would take longer the more friends you have. Basically, it would grow linearly with the size of all the sets and the number of intersections found. Something like O(n * M) in the worst case. But I don't get why later you say that n is the size of the smallest set.

So I don't see how you can beat that. I guess you could sort the lists, but that take O(n log n) over M lists, and then lookups would take O(log n).

To me it will be fastest when the algorithm terminates the quickest - <USER2> smallest set contains nothing, the 2nd smallest set contains no intersecting keys, anything like that and will be the longest in the worst case (each set is a proper subset of the next) and progressively worse as the subsequent sets get larger.

As for that algorithm running in O(N * M), I am not sure I understood that at first, but I think I do now. If you hold all other set sizes constant, and can only vary the input of the smallest array or the number of sets and you will notice the running time follow O(N * M), but if you increase the size of the largest set by k, then the algorithm will take k times as long to run (in the worst case), but if the running time function f(N,M) belongs to O(N * M) then k * f(N,M) belongs to O(N * M) as well, so the O notation still represents the running time complexity even if you increase the size of the largest set.

So the running time will still increase with the largest set, but the O-notation of the algorithm will still belong to the same representation.

<comment><USER50> With extra memory, and if you don't care about ordering, multiple set intersection can be made O(N) where N = size of each set added together, assuming no duplicates in any single set (which should be true, but it depends on how loosely you are using the word set) You only have to walk each element exactly once, and all other operations are (amortized) O(1)

For each element in all sets: Insert element into hash table. If it does not exist, use key = element, value = 1. If it exists, increment counter. This is O(1)

When done over all sets, it's O(N)

Walk hash table, the only elements that are in the intersection are those with value = number of sets. This is O(N)

O(N) + O(N) = O(N). This only works if there are no duplicates within a single set. It transforms set intersection into a counting problem over the universe of elements.

You can optimize it as well. You never need to deal with elements that don't exist in the hash table after the first set is processed, as they can never be in the intersection. This does not change the asymptotic complexity, except it means the hashtable will never resize after the first set. So it's advantageous to choose the smallest set to process first if you can do so easily. If you use dynamic perfect hashing or something similar, you can also guarantee all operations after the first set will be O(1), rather than amortized O(1).

<comment><USER28> That ("how would you implement ruby array intersection operator & and what computational complexity does your implementation have") was actually one of my interview warmup questions. In ruby core it's done exactly like you described, using a hash table, but I didn't know that until after the interview. I proposed a slightly worse solution, with sorting both inputs and then walking them simultaneously, which was O(n*log(n)). Still got the job, though :)

As a side note, I think that tasks like "implement a data structure with following operations and calculate computational complexity for each operation" are much better for exam than trivia questions like "Name the heap operations used by heapsort and the asymptotic running time of each.", with all due respect to @cperciva.

</comment></comment></comment></comment></comment></comment></comment><comment><USER51> I see a common argument in the comments here. Many of us are saying this is "Computer Science" and not "Software Development". In my opinion, knowledge of the answers to these questions will make you a better software developer. Ofcourse, without knowing any of these, you can still develop software that will work. But if you know answers to these questions (and many other similar computer science questions), you can make smart decisions on how to implement the software you are developing in a more efficient manner.

</comment><comment><USER52> I knew the answers to all of these questions two years ago when I had just graduated, but I've completely forgotten what heapsort is (despite having used it a few times in programming contests) and cannot offhand remember what "bipartite" means (googled, saw the wikipedia image and instantly remembered maxflow and Ford–Fulkerson although I guess a DFS is good enough to determine bipartite-ness).

Why is the ability to retain this information at the top of my mind at all times necessary for me to be a Software Developer?

</comment><comment><USER53> If it was a simple form that sent an email you'd probably get 100x more results. People are lazy.

<comment><AUTHOR> Given the rate at which I'm getting emails, I don't want 100x more results!

<comment><USER54> How many have you got already?

<comment><AUTHOR> 16 in the first 1.5 hours.

<comment><USER55> Given that you're only getting dozens of replies, why are you asking for institution? The only useful pattern I can think of would be something like correlating against university ranking, but that doesn't sound too useful.

<comment><AUTHOR> I was thinking I'd start with a "places most of us have heard of" (Oxford, Cambridge, Harvard, MIT, Stanford, etc.) vs. "everywhere else" comparison. I'm at somewhere over 100 replies at this point, so I imagine I'll have enough data for that sort of comparison to be meaningful.

</comment></comment></comment></comment></comment></comment><comment><USER56> Carl Sagan said "If you wish to make an apple pie from scratch, you must first invent the universe."

I'm a web developer. I use tools, languages, and frameworks built on many Computer Science concepts that I don't fully understand, but I would sorely hate to have to reinvent those wheels every time I need to create a new application, or to even need to understand their most intricate inner workings despite the fact that they have been abstracted away for my convenience.

Perhaps this makes me "mediocre" in the eyes of some, but I get my work done and have never had any of my managers or customers tell me that what I have delivered is "mediocre" in their eyes.

Several times I've come up against an issue that requires me to push the limits of my skills and knowledge, and I do not shy away from learning, but it would do me little good to learn many of the things that are taught in a typical CS course. I consider myself passionate about my work, and I strive to learn new things every day, but I don't consider myself to be at a disadvantage, nor do I find my lack of knowledge in those areas to be a deficiency.

I am proud of my accomplishments, and of the course I have taken in my career. Perhaps my skills would be of little use at Tarsnap, but I have no shortage of work at any number of other companies.

</comment><comment><USER46> I remember reading a thread someplace (I think here or at reddit) that criticized the traditional software developer interview process. One person made the suggestion that the reason why a lot of companies ask more...bookish knowledge that seems like its from college homework/final exam, is that they don't want to admit that what they do is relatively mundane, and doesn't really require the daily application of the kind of thing you find on your data structures or operating systems final exam. So, they add complexity to their interview questions, as well as their development process, to compensate.

Does anyone know if traditional, "real" engineering fields, (civil, chemical, mechanical, etc) ask detailed, technical kinds of questions during interviews, like software engineering is known for? I find it hard to believe civil engineers get bombarded with all day grill fests by other civil engineers about technical questions in interviews, but I really don't know.

</comment><comment><USER57> This is so depressing. I just finished a degree in "Information Systems" with the hopes of being a developer full-time and I can't answer any of these questions.

I guess I should be mad at the institution, but that wouldn't be productive. Where do I start now to start learning what I actually need to know? It seems like there is so much I don't know.

<comment><USER58> This is a very good book: [http://www.amazon.com/Introduction-Algorithms- Third-Edition-...](http://www.amazon.com/Introduction-Algorithms-Third- Edition-ebook/dp/B007CNRCAO/)

I will say though, it's really intense on theory, and it requires a good background in math. A lot of people will recommend this book though. Also, it's physically heavy :)

<comment><USER59> That book is considered the 'Bible' of this area but I wouldn't recommend it to anyone who is looking to get started. It's like reading the dictionary.

</comment></comment></comment><comment><USER60> I feel like this test would be better if it were reasonably timed, and you were allowed to look up the answers. That might be a little bit closer to what I actually do (especially when I don't know what something is). Calling me lucky to get by without knowing offhand the definition of a B-Tree, is kind of rude and also very wrong.

</comment><comment><USER61> This is a problem in our industry. These are not "Software Development" questions. These are "Computer Science" questions.

</comment><comment><USER62> But you should Google _afterwards_ so you can feel like a right ponce for confusing Big-Theta and Big-O.

</comment><comment><USER63> Too bad the author does not care to ask for the more important bits of developing software but devulges into questions a web crawler could answer. Creating elitisim (by offensively downgrading any developer who cannot answers these questions or simply has to look up an answer) does benefit no one. Developing software is so much more than details of an algorithm, of an operating system or a network topology. It is about needs, about requirements, users, customers, support, processes, technology and the list goes on and on. Simply put, he is not asking questions for software developers but for programmers.

<comment><USER64> That isn't an exercise in elitism. It is an extremely easy test to anyone who is actually trained in computer science.

If you can't answer the questions, then you should try to fill the gaps in your knowledge rather than whining that it's elitist.

</comment></comment><comment><USER65> A little off topic but this domain hosts a hacker news daily updated archive located here: <http://www.daemonology.net/hn-daily/>

Thanks cperciva for hosting it!

<comment><USER66> I've settled for <http://hckrnews.com/> as the HN filtering site -- you can switch between Top 10 / Top 20 and for extreme procrastination, "Top 50%". With a Chrome extensions you can also track # of comments since you last time read them, for the stories with interesting discussions.

</comment></comment><comment><USER38> The idea is good, but the questions not so much. First off, the number of questions is too small for a subject so large as algorithms and data structures; I'd rather have something in the 25-40 range. But that of course, for objective questions which answer is a one-line sentence max (not requiring writing code or calculation).

And this approach is the second problem. A few questions of this kind are good; for one, I like Q.1 (trivial if you know the subject, puzzling if you don't as the proposition is just nonsensical as a mathematical problem). But some other questions are tests of memorization, sometimes for not too relevant information. For one thing, you ask to "name" heapsort operations. I have long forgot those names, BUT I know the fundamental ideas of heaps and heapsort, and writing the full heapsort (even in paper) is a simple exercise of coding... but I wouldn't still remember those names.

Also, I would spend significant time writing this code (and also deducing the complexity if I don't know it by heart), compared to somebody who just crammed through textbooks. (And yes, it _is_ possible to memorize this kind of information in a few days of cramming; if those final exams have schedules known well in advance and they are spread at least 3-4 days from each other, this pretty much cancels the advantages you mention.)

You seem to be dismissive of "practical programming ability"; I agree that code as answer to written questions has issues -- coding problems are better in a whiteboard test, interacting with the examiner. Or with careful restrictions of language etc. But it seems wrong to have questions that penalize (due to time restrictions) people who can deduce the answer with some coding or calculation, and reward people who just memorized the subject... for one thing, this memory won't last forever, unless you become a professor to keep "practicing the theory" on a daily basis. But more important, the ability to deduce the answer is very revealing of somebody's knowledge of the really fundamental concepts. Show me a CS graduate who knows by memory the bipartite graph algorithm, and this _may_ be just some guy that has study discipline and good memory but is clueless about the core ideas of graphs and will have forgotten everything after a couple years of graduation. Now take somebody who can sketch the code for bipartite testing, even when given a problem that does not use the word "bipartite" or even the word "graph" -- so the student needs to identify the proposed problem as a specific graph problem, and _then_ deduce the algorithm in order to solve the graph problem -- and that's somebody I would hire, either for a software engineer position or for a professor position.

</comment><comment><USER67> Software engineering and/or programming is a vast, vast field. Anything you can express logically, someone somewhere is expressing in software. This "or you're lucky enough to be working within a narrow area where your deficit doesn't matter" should read "or you're lucky enough to be working outside this narrow area so your deficit doesn't matter".

<comment><AUTHOR> Note: What you're seeing today is just 1/4 of the test. The other three parts cover different areas.

</comment></comment><comment><USER68> Question for the author: are these things that YOU knew before working on the projects that required them?

<comment><USER24> Pretty sure a PhD in Computer Science, like Dr. Colin Percival (the author) has to known that stuff. Even a lowly undergraduate like I was had to learn it by the second year.

<comment><USER69> I was writing software professionally in high school. Second year undergrad seems a little late in life to be learning this stuff, if it is critically important.

</comment></comment></comment><comment><USER70> Why do people who like to ask O(N) questions have this obsession with sorting algorithms?

<comment><AUTHOR> Because in the 1960s, sorting records was what computers spent most of their time doing.

At this point, it's mostly a "because that's how we've always introduced algorithms and complexity" thing.

<comment><USER20> It's still what computers often spend a lot of time doing. What do you think your database engine is doing most of the time? Those indexed columns aren't just there to smile warmly upon your data.

</comment></comment></comment><comment><USER71> I wonder about the utility of an exam that one can ace with five minutes of googling.

<comment><USER72> I use these kind of questions in interviews. You either know the answers or you don't. There's no looking at your 'phone in an interview (at least not one with me being the interviewer).

<comment><USER71> Fair enough. I take a different approach in my interviews: try to gauge how useful the person will be to the team. We have internet access, and a library with CLRS if someone needs to implement a bipartite graph test. It matters more to me that they'd know why they'd need one.

<comment><USER72> We use those kinds of approaches too. I never said the interview consists solely of closed book tests, they're just one thing I find useful to help gauge the suitability of an interviewee.

[EDIT] The thing I'm most looking out for is how a candidate answers when they don't know the right answer.

</comment></comment></comment></comment><comment><USER73> I had to omit proofs to complete in 15 min.

This will obviously not be a representative sample of working programmers (or even readers of this post). People who know they don't know are less likely to respond.

</comment><comment><USER74> I think I could do the first and the fourth (economist by day, coder by night). Answers to the others elude me: good tutorials and relative importance to coding would be greatly appreciated!

</comment><comment><USER75> That looks like a "Computer Science" final exam. Software dev != CS.

<comment><AUTHOR> It's a "Computer Science software developers should know" exam.

</comment></comment><comment><USER76> I have a question: These are pretty rudimentary questions and if you have a background in the literature, you could brush up in about an hour or two on most of this stuff (aside from memorizing the catalogue of data structures and algorithms you might find in a text book [which makes me wonder why he's focusing on _these_ questions instead of an understanding of induction, space analysis for an arbitrary data structure, or general Big-O/Big-Omega analysis]), but why don't we actually come across uses for that sort of basic stuff all that often?

I mean, I don't know if what I do is all that specialist, but I spend a lot more time working out far less interesting things about how domain knowledge works than what sort of Data Structure or Algorithm is best for storing it and using it.</comment>


The coronavirus wasn't made in a lab. A genetic analysis shows it's from nature - <AUTHOR> https://www.sciencenews.org/article/coronavirus-covid-19-not-human-made-lab-genetic-analysis-nature <comment><USER2> Quote from the article;

 _An unfortunate coincidence fueled conspiracy theorists, says Robert Garry, a virologist at Tulane University in New Orleans. The Wuhan Institute of Virology is "in very close proximity to" the seafood market, and has conducted research on viruses, including coronaviruses, found in bats that have potential to cause disease in people. "That led people to think that, oh, it escaped and went down the sewers, or somebody walked out of their lab and went over to the market or something," Garry says.

Accidental releases of viruses, including SARS, have happened from other labs in the past. So "this is not something you can just dismiss out of hand," Andersen says. "That would be foolish."_

So if the idea that the virus escaped from Wuhan Institute of Virology would be "foolish" to "dismiss out of hand" why disparage the people who raise the question and concern as "conspiracy theorists"?

Seems a bit unfair to me and counter to purpose. Moreover, the modern phenomenon of "conspiracy theorist" is a manifestation of rank skepticism and doubt in the culture today -- not a euphemism for reasonable speculation or inference based on evidence. Of course I would be a "conspiracy theorist" if I now claimed that Mr. Garry has been compromised by the forces of evil and in on the conspiracy too.

Personally, I am glad that they took the time to rule this out because it was one of my concerns. I also look forward to another independent lab confirming the results to rule out the possibility that Mr. Garry is in on the conspiracy ;-)

<comment><USER3> I think this video got posted yesterday, but at first glance, it didn't seem all that unreasonable to think the institute somehow originated it: [https://www.youtube.com/watch?v=bpQFCcSI0pU](https://www.youtube.com/watch?v=bpQFCcSI0pU)</comment></comment>


What fossil fuels are doing to our oceans - <AUTHOR> https://newhumanist.org.uk/articles/5134/trouble-at-sea-what-fossil-fuels-are-doing-to-our-oceans <comment><USER2> It's not really enough to read and upvote, but I'm at a loss as to what I can personally can do about this.

So in the spirit of the askhn "how would you turn around Twitter" \- let's apply the same thinking to this: "how would you fix the oceans "?

There must be some practical steps that one or many of the hn audience can execute?

<comment><USER3> I see people mentioning things like "become a vegetarian" or "bike to work", but those are easy and neglible-impact things. Sure, they'd have a huge effect if half of the population suddenly adopted them, but that's not going to happen - so just going vegetarian yourself and calling it a day is not really helping anything.

What I'd love to see is a list of high-impact work one could use their _skills_ to help with. Maybe some research groups would use a better software package? Maybe there's a process that could help and is not yet economically viable, but could be made such?

Let's try and list things like that.

<comment><USER4> Data centers use a lot of power. Make data centers more efficient, for example by improving GCC or the Linux Kernel, and you can save a chunk.

Don't write your billion-user apps in Python, use a more efficient language like Rust or Go. Don't make 10MB webpages where 100kb would also suffice.

But I think useful change can only be made using political means. Write your representatives and tell them how you feel. Vote for politicians who want to change things.

<comment><USER5> Data centers are about 1-2% of emissions.

Animal agriculture is comparable to all transit, while heating/cooling/electricity is heavily at the top.

If I were profiling I'd optimize the highest bottleneck first.

<comment><USER4> I don't think many people on HN have the skills to make other people stop eating animals, so I focused on computers.

</comment></comment></comment></comment></comment><comment><USER6> If we don't manage to turn this stuff around then all this tech progress we read about all day won't mean very much.

I'm talking about things like VR and new programming languages... Obviously tech that saved the oceans would be a different story...

</comment><comment><USER7> Reading this struck me: What is the difference between primordial volcanoes and human pollution? During the dinosaur age it was a lot hotter [0] and there were really extraordinary organisms. Further reading seems to go down a rabbit hole [1],etc.

[0][http://blogs.ei.columbia.edu/2014/07/11/what-geology-has- to-...](http://blogs.ei.columbia.edu/2014/07/11/what-geology-has-to-say-about- global-warming/) [1][https://www.theguardian.com/environment/blog/2010/apr/21/ice...](https://www.theguardian.com/environment/blog/2010/apr/21/iceland- volcano-climate-sceptics)

<comment><USER8> The difference is that during primordial times, we did not have all our infrastructure built out across the globe.

Although global warming is often talked about in "bad for the Earth" terms, really, the Earth will be just fine. It's been through worse.

Global warming is scary because it's bad for human societies. We built our cities and farms and national boundaries in certain places based on the climate we have had. Significant shifts in sea level, precipitation, temps, etc. will cause massive costs and unrest.

<comment> wu-ikkyu >Although global warming is often talked about in "bad for the Earth" terms, really, the Earth will be just fine

In the wise words of George Carlin:

>The planet is _fine_. The people are fucked!

</comment></comment></comment><comment><USER9> I wish some billionaire would start a chain of carbon neutral gas stations. I wouldn't mind paying more for gas if I knew it was carbon neutral. There are several ways the gas could be carbon neutral, either through production (solar/wind into fuel creation) or offsets (plant trees or carbon sequestration). Instead of slowly trying to change our transportation infrastructure to EV, which will take decades, this could have immediate impact now.

<comment><USER10> Quick 'back of the envelope' (literally) calculations:

Toyota Camry [0] Dual VVT-i engine gets 7.9L/100km and 183gm/km emissions. That roughly works out as 2.3kg CO2 per 1L petrol.

Therefore, a tonne of CO2 is produced for every ~430L petrol. Petrol is around AUD $1.40/L, so about AUD $600 of petrol.

Carbon credits [1] are worth about $14 euros per tonne of CO2, which is say AUD $19.

Therefore 'carbon neutral' petrol adds about AUD$20 to AUD$600 worth of fuel, or about 3-4%.

Sound about right? I could stomach that, considering the fuels price goes up and down all the time anyway...

[0] [http://www.toyota.com.au/camry/features/economy-and- environm...](http://www.toyota.com.au/camry/features/economy-and-environment)

[1] [http://www.goldstandard.org/blog-item/carbon-pricing-what- ca...](http://www.goldstandard.org/blog-item/carbon-pricing-what-carbon- credit-worth)

EDIT: formatting...

<comment><USER11> This is what confuses me, if it only costs 10% more to fix the problem, why the hell is it still a problem?

<comment><USER12> Correct me if i'm wrong, but i don't think that's how carbon credits work? Paying 10% more for gas doesn't magically reduce the CO2 emitted. I would expect that at some point, someone has to actually not emit CO2 for this to work.

<comment><USER10> The carbon credit _is_ the (market-based) mechanism by which someone else has to not emit, or sequester, the CO2. [0]

Of course, it relies on there actually being a cap on carbon in the first place...

[0] [https://en.wikipedia.org/wiki/Carbon_credit#How_buying_carbo...](https://en.wikipedia.org/wiki/Carbon_credit#How_buying_carbon_credits_can_reduce_emissions)

</comment></comment></comment></comment></comment><comment><USER13> Oceans? We can't even keep our own drinking water safe.

</comment><comment><USER14> I don't think it's off base to say that within out lifetime the oceans will be completely destroyed. So many mass-die offs of ocean life lately.

<comment><USER15> _within out lifetime the oceans will be completely destroyed_

A bit of an exaggeration, no? There have been several mass extinction events in the past and yet the world exists today.

<comment><USER16> I'm sure the world will recover just fine in a few hundred million years.</comment></comment></comment>


3D Printing a Chair with Puzzle Pieces - <AUTHOR> http://www.polyglotprogramminginc.com/adventures-in-3d-printing/ <comment><USER2> The RAMPS shield burned up because the $20 knockoff shields don't use sufficient connectors or copper weight on their boards. We see this quite often in #reprap and I always advise people not go cheap on the board. Ultimachine ramps cost a lot more for a reason...they don't catch fire...and if there was any issues johhnyr would make it right.

</comment><comment><USER3> I like this. I'm buying an xcarve [1] this summer and have a few ideas in development to build large scale items from inter-locking parts. This kind of 3d imaginative thinking will be required for the first few years of hobby CAM.

Inspiring projects like this should help bring people into the fold.

[1] [https://www.inventables.com/technologies/x-carve](https://www.inventables.com/technologies/x-carve)

</comment><comment><USER4> How'd you make a software which turns a 3D object - with maybe some constraints on geometry - into a set of smaller, printable interlocked parts?</comment>


Ask HN: Links to older resources like Calculus Made Easy - <AUTHOR> This recent thread https://news.ycombinator.com/item?id=23257303 made me wonder if there were any old resources, and I would say 100 years or older should be the requirement, on subjects or a mathematical, technical or scientific nature that are a better introduction than most of today's works. <comment><USER2> Here: [https://archive.org/details/folkscanomy_mathematics](https://archive.org/details/folkscanomy_mathematics)

Hilbert, Courant, Bourbaki, Hadley, Dieudonné, Hardy, Descartes, Cauchy... They're all there. Could last you a lifetime.

For more "recent" ones, there's [https://mirtitles.org/](https://mirtitles.org/), which specializes in Soviet era books from MIR Publishers or, as I've known them in my translated college textbooks, "Éditions MIR". Demidovich, Smirnov, Piskunov, Kolmogorov, Tarasov, Irodov, they're all there...

As an aside, look at " _Cours d 'Analyse de l'École Polytechnique_" by Augustin-Louis Cauchy in 1821. Look at the typography, the layout, table of contents. Pretty LaTeX like if you ask me. The last paragraph of the introduction where he thanks people who've helped him... Poisson, Ampère, and Coriolis. Damn.

</comment><comment><USER3> Good question! Here is one that I thought of: [http://507movements.com/](http://507movements.com/)

<comment><AUTHOR> that's great, I've seen that before but forgot it, I just found a review of it in IEEE Robotics & Automation Magazine

[https://www.researchgate.net/publication/260691262_Five_Hund...](https://www.researchgate.net/publication/260691262_Five_Hundred_and_Seven_Mechanical_Movements_Brown_HT_On_the_Shelf)

</comment></comment><comment><USER4> What is mathematics? It helped Einstein to understand maths.</comment>


User Agents in the morning - <AUTHOR> http://www.stevesouders.com/blog/2009/01/18/user-agents-in-the-morning/

<comment><USER2> The author seems quite happy with his daily morning routine of _classifying user agent strings_ , exemplifying Milton's satanic logic: "The Mind is its own Place, and there within, can make a Hell out of Heaven, or a Heaven out of Hell."</comment>


Norway is shutting down after corona virus outbrake - <AUTHOR> https://theweek.com/speedreads/901770/entire-country-norway-shutting-down <comment><USER2> I think 1/2 of Norway is now working from home. Only the ones having critical work (list of 15 worktypes) are entitled to kindergarten.</comment>


Bald's Leechbook Now Online – 10th century Anglo-Saxon medical recipe compendium - <AUTHOR> http://britishlibrary.typepad.co.uk/digitisedmanuscripts/2016/01/balds-leechbook-now-online.html <comment><USER2> Is it possible for these old remedies to matter today? For an investigation into this and for a story worthy of HN to boot listen to / read the transcript of this RadioLab podcast.

[http://www.radiolab.org/story/best- medicine/](http://www.radiolab.org/story/best-medicine/)

<comment><USER3> That episode was pretty interesting, and it gives a whole new perspective on traditional medicine and science.

TLDR - a microbiologist and a historian decided to try a very old cure for a stye (staph infection in a pore of the eyelid). After brewing it and testing it several times it proved to be extremely effective against staph (including MRSA).

Why did the cure stop being used? Likely the same problems we're facing today - resistance. After nearly 1000 years of disuse, the cure has become effective again as staph has lost that specific resistance.

<comment><AUTHOR> As an historian of early modern medicine I absolutely love the historical component of this story and I trust the microbiologist's expertise regarding the efficacy of the cure. But I'm extremely skeptical about the resistance claim. First off, what evidence do we have that this cure was ever widely used in Anglo-Saxon times? We'd require not just its presence in Bald's Leechbook but the 9th century equivalent of actual treatment records, or some kind of material/archeological evidence like remains of this specific cure in drug jars (which so far as I know don't exist). Second, Anglo-Saxon England was basically a backwater in terms of the total human population of the time and was not particularly well integrated into larger global networks. If the cure was present in a Tang Chinese text or even something from northern Italy or the Byzantine Empire, it would be more convincing that it would have had far- reaching epidemiological effects, but with the existing evidence I think it's a huge leap to assume that it actually was used to treat enough people successfully that it resulted in widespread resistance.

Anyway, I still really enjoyed the Radiolab piece about this (I love that they met at a Viking re-enactment!) but I think the implications of this have been really distorted in the popular press. We'd need to know an order of magnitude more about the global disease environment in Late Antiquity to actually make any guesses about the impact of this cure at the time it was set down.</comment></comment></comment>


Founders Come First - <AUTHOR> http://www.trueventures.com/blog/2010/09/22/founders-come-first/ <comment><USER2> It's the beginning of the end of yet another bubble as far as I read the tea leaves, and I'll be very happy when all those throwing silly money at unproved concepts have gone away to lick their wounds for another decade or so.

The current bubble is powered by the success of the likes of facebook, twitter and mint, everybody that has a $ to spare wants to be in on the action.</comment>


Show HN: PSPTool – Parse and Trace Firmware of AMD's Platform Security Processor - <AUTHOR> https://github.com/cwerling/psptool <comment><AUTHOR> The author here. Although some previous work on this controversial subsystem that is comparable to Intel ME was done [1, 2], this tool aims to lower the entry barrier for looking into the code running on the PSP (and other AMD subsystems, too). The PSP is running completely proprietary, undocumented code provided by AMD. It has full access to the x86 memory and is therefore a valuable target for attacks.

[1] [https://seclists.org/fulldisclosure/2018/Jan/12](https://seclists.org/fulldisclosure/2018/Jan/12)

[2] [https://msrnd-cdn- stor.azureedge.net/bluehat/bluehatil/2019/...](https://msrnd-cdn- stor.azureedge.net/bluehat/bluehatil/2019/assets/doc/The%20AMDFlaws%20Story%20Technical%20Deep%20Dive.pdf)</comment>


Paul Graham Just Emailed Portfolio Companies Warning Of 'Bad Times'  - <AUTHOR> http://www.businessinsider.com/facebook-fallout-y-combinators-paul-graham-just-emailed-portfolio-companies-warning-of-bad-times-in-silicon-valley-2012-6?op=1

<comment><USER2> <http://news.ycombinator.com/item?id=4067297></comment>


Skills Self-taught Programmers Might Need - <AUTHOR> http://simpledeveloper.com/important-skills-self-taught-programmers-lack/

<comment><USER2> Some of these things (like compilers) are often optional modules on CS courses. I think it's difficult to practice programming for very long without figuring out different data structures and recursion , sorting etc.

You may also run into compiler problems when you need to do anything complicated with text, at this point playing around with a PEG for a while can get you quite far and is reasonably intuitive.

OTOH you are more likely to lack the formal underpinnings and math behind it. Then again, how many people would be able to pass a drilling on Big O/Theta analysis 10 years after completing their degree?

<comment><USER3> for those who are not sure what @jiggy2011 means by PEG, it is basically an acronym for [parsing expression grammar](<http://en.wikipedia.org/wiki/Parsing_expression_grammar>).

</comment></comment><comment><USER4> If you're relying solely on an undergraduate degree in CSE to cover these topics then you're probably also lacking these skills, at least in a truly meaningful way.

</comment><comment><USER5> This is kind of rolled into compilers, but automata and state machines are another. I've seen a lot of wheels partially reinvented by self-taught programmers, with bad results.</comment>


Ask YC: What's your startup going to change? - <AUTHOR>

What's your startup going to change that breaks up business as usual? <comment><USER2> Many businesses still keep a tremendous amount of important information in spreadsheets. Yet spreadsheets haven't really evolved since their inception. We're changing that, and by doing so, we hope to free companies up from just being reactive and trying to keep pace with day-to-day activities, and allow them instead to push towards new models and new ways of doing business.</comment>


Ethereum fixes serious "eclipse" flaw - <AUTHOR> https://arstechnica.com/information-technology/2018/03/ethereum-fixes-serious-eclipse-flaw-that-could-be-exploited-by-any-kid/ <comment><USER2> A thing I've noticed about cryptocurrency news. The people that are pro cryptocurrency are often far too optimistic and sometimes are not the most academic people. However I've also noticed that those that constantly critique cryptocurrency are often so wrong about their assumptions it's just pointless reading on. It's so hard to actually get a reasonable discussion about cryptocurrency.

<comment><USER3> Maybe we should create some discussion system where in order to post you need proof of expertise (PoE)

<comment><USER4> Maybe you could count number of Ph.D contributors? I bet Bitcoin has as many or more than every other project combined.

<comment><USER5> Citation needed. Appeal to authority, with no evidence of competency.

</comment></comment></comment></comment><comment><USER6> For those interested, here's the paper: [https://www.cs.bu.edu/~goldbe/projects/eclipseEth.pdf](https://www.cs.bu.edu/~goldbe/projects/eclipseEth.pdf)

Here's the partial-implementation of Countermeasure 2 in geth: [https://github.com/ethereum/go- ethereum/pull/16069](https://github.com/ethereum/go-ethereum/pull/16069)

Of note, this fix is still susceptible to attacks, though still an improvement:

> Since geth v1.8.0 still allows the attacker to freely craft node IDs that > land in specific buckets, the partial implementation of Countermeasure 2 in > geth v1.8.0 means that for a given victim's table, there can be at most 10 > attacker node IDs associated with each attacker IP address. While this > improves on the situation prior to geth v1.8.0 (where we could eclipse our > victim using just one or two IP addresses), it does not raise the bar for > attackers quite as high as we had hoped.

Still making my way through the paper and the PR to identify other things fixed. Here's the entire 1.8 release: [https://github.com/ethereum/go- ethereum/releases/tag/v1.8.0](https://github.com/ethereum/go- ethereum/releases/tag/v1.8.0)

</comment><comment><USER7> This wasn't a flaw with Ethereum itself or its protocol, but rather an issue with one of the its client implementations (go-ethereum), other clients like Parity, Harmony, etc.. are unaffected.

<comment><USER8> Is there any other field of computer security where this argument is acceptable? Usable security matters. Ecosystems matter. You cannot put a boundary somewhere in the middle of what the end user sees and call your security job done.

When people majorly botch x509 cert validation because the spec is so monstrously complex _that 's still a problem with x509_.

<comment><USER9> Ethereum specifically chose to develop around multiple clients to mitigate the risks of implementation errors such as this. It would be ideal if all were perfect from the start, but no software is, security or otherwise.

</comment></comment></comment><comment><USER10> Isn't relying on IP diversity as a measure of attack difficulty a bad assumption in the first place? If an attacker has access to the cable outside my home, then they can pretend to control as many IPs as they want.

It seems to me that the most reliable defense against eclipse attacks is to just compare the block rate of the longest chain we know about to the historical average. If the block rate is roughly normal, then either we're seeing the real longest chain, or an attacker has acquired nearly 50% of hash power, which is unlikely.

The same idea works with proof of stake -- if the participation rate drops substantially below the historical average, we're probably not seeing the main chain, and we shouldn't consider anything final until the participation rate return to normal.

<comment><USER11> > Isn't relying on IP diversity as a measure of attack difficulty a bad > assumption in the first place? If an attacker has access to the cable > outside my home, then they can pretend to control as many IPs as they want.

If an attacker has access to the cable outside your home they have already won, it's game over.

>It seems to me that the most reliable defense against eclipse attacks is to just compare the block rate of the longest chain we know about to the historical average. If the block rate is roughly normal, then either we're seeing the real longest chain, or an attacker has acquired nearly 50% of hash power, which is unlikely.

Block creation have high variance. Over short periods of time, say a few hours no blocks being announced is fairly common. Over long periods of time how do you know the mining power has not decreased or increased at a slow rate than your person prediction.

>The same idea works with proof of stake -- if the participation rate drops substantially below the historical average, we're probably not seeing the main chain, and we shouldn't consider anything final until the participation rate return to normal.

Interesting you can design PoS systems such that if not a quorum of stake is online, no new blocks are created. Algorand has some very neat properties in this regard.

<comment><USER10> > If an attacker has access to the cable outside your home they have already > won, it's game over.

Not if I'm looking at the block times or PoS participation rates. The attacker can feed me their own fork while preventing me from seeing the actual highest- difficulty chain, but their fork will be suspiciously weak, so I'll know not to trust it.

> Block creation have high variance. Over short periods of time, say a few > hours no blocks being announced is fairly common. Over long periods of time > how do you know the mining power has not decreased or increased at a slow > rate than your person prediction.

Yeah; with Bitcoin you would need to wait several hours to get a good estimate of hash power. With more granular blockchains like Ethereum you could get a good estimate more quickly.

<comment><USER11> >Not if I'm looking at the block times or PoS participation rates. The attacker can feed me their own fork while preventing me from seeing the actual highest-difficulty chain, but their fork will be suspiciously weak, so I'll know not to trust it.

Would be really interested to read a paper that invents a confirmation sureness metric based on distances between block times which takes into account eclipse attacks.

</comment></comment></comment></comment><comment><USER12> This is an attack on the Kademlia DHT.

Why exactly does Ethereum use Kademlia anyway?

Kademlia's main purpose is to find content distributed among a small percentage of nodes.

Ethereum doesn't need this, since the entire blockchain is stored on every node.

And does the attack also work against other applications that use Kademlia, such as IPFS and I2P?

</comment><comment><USER13> There are some fun systemic probabilistic attacks based on peer discovery.

One such principle which doesn't need many attacking nodes, rely on peers self-clustering themselves over time is the following :

You divide the peer network in 2 groups. Using a few number of attacking nodes, when a peer from one group ask you for a node you know, you answer with a peer from the same group. Then each peer from each group is more likely to recommend a peer from the same group. Over time bias accumulate, and cluster forms, with very few bridges between the two groups which you control.

Obviously it can be mitigated easily by adding some hard-coded "central" nodes or monitoring the network.

Afaik robust peer discovery in p2p network is still not solved.

</comment><comment><USER14> > The fix for the second attack involved limiting the number of outgoing > connections a target can make to the same /24 chunk of IP address to 10. The > changes are designed to make it significantly harder to completely isolate a > user from other legitimate users.

Maybe it is the way the article is written, or how I've read it, but the original flaw involved just 2 nodes w/ 2 IP address. This fix sounds like you need 2 nodes w/ 2 IP addresses that don't have the same /24 octal? Is it that much more difficult?

> When even a single node presents users with a different version of the > blockchain, they will be warned of an error that effectively defeats the > attack.

Doesn't this just mean the attacker has to make sure to control all 13 connections before starting the attack?

</comment><comment><USER15> the image in the article is really appropriated, the Turing complete VM of ethereum is a black hole of bugs, on the Genesis, some really bad engineering decisions were made and probably now is too late to change it.

<comment><USER7> Out of curiosity, what "really bad engineering decisions" are those?

<comment><USER15> My view, of course, every decision as a trade-off, everything i say is controversial

\- The main ledger and smart contracts should be separated, everyone smart contract is public, why??

the smart contracts should be run on several specific sidechains. Why if I buy a crypto kittie everyone as to know and store the transaction for all eternity.

Wait sharding is coming, yes but will reduce the security guarantees.

<comment><USER7> There are different solutions for that in the works, from sharding to plasma, etc.. and those have their own challenges & tradeoffs (namely in terms of security, etc..)

However engineering decisions 'on genesis' was over 3-4 years ago and at that time doing a blockchain with smart contracts was already challenge on itself. It's not really fair to take the knowledge and lessons from the present day and claim those in the past without that knowledge made horrible decisions. It's a bit like blaming google for not starting angular 1 with the functionality of angular 4, or saying that John Resig should have created Babel and ES7 features instead of creating jQuery.

<comment><USER15> > However engineering decisions 'on genesis' was over 3-4 years ago and at > that time doing a blockchain with smart contracts was already challenge on > itself. It's not really fair

Sorry when I heard about Ethereum plans 4 years ago, I tough it as a terribly bad idea then (I didn't invest because of this, I should have invested stupid me) in 2013 the increase size of blockchain was already an ongoing problem, I simply tought if a decentelized ledger is already problematic to store, let's put a lot of more information on it, it's madness..

</comment></comment></comment></comment></comment><comment><USER16> After CryptoKitties, it's difficult to take Ethereum seriously.

<comment><USER17> That's like saying "after the fart app, it's hard to take iOS seriously".

<comment><USER16> I don't really take iOS all that seriously, either.

Of all the things anyone would trade for money Cryptokitties is really riding the line between smart and so dumb it devalues the concept of Ethereum, which might have been the point.

<comment><USER18> So...because we got hamsterdance.com at one point I guess that means the internet is hard to take seriously?

<comment><USER16> Hamsterdance.com was a masterpiece of early Internet adoption. Try to get anything that viral.

Ethereum is a weak attempt at money laundering.

</comment></comment></comment></comment></comment><comment><USER19> I was downvoted when I mentioned this issue 52 days ago:

[https://news.ycombinator.com/item?id=16114295](https://news.ycombinator.com/item?id=16114295)</comment>