Live data from Hacker News

Programmers can’t write algorithms without help

queworx.com

21–30 of 105 posts

Re: Programmers can’t write algorithms without help

#21
post #2

> Programmers can’t write algorithms without help And that might be a good thing. How often does a normal software engineer have to write bubble sort from scratch in his daily life? If someone from my team came to me telling me he had to sort an array and wrote bubble sort from scratch, then I'd probably not be very happy with that unless there is a really good reason to spend that time on it rather than using an exi…

I agree. In a world where good standard libraries exist, and where Google exists, why would a good software engineer write any of the standard algorithms from scratch?

Re: Programmers can’t write algorithms without help

#22
post #10

Earlier quoted context omitted.

I agree, what's more important IMHO is education/knowledge of existing data manipulation, after all 99% of the work is reuse not pure creation (incremental vs pure innovation). Algorithmicians (? - well... algorithm researchers, obviously) and programmers are not working in the same field of work, even though the boundary might seem thin for most, there's a world between both. Must all painters be artists?

I would go as far as saying that an "artist" might be detrimental to reaching your goal in a lot of cases, especially if a team is involved.

To stretch the analogy to the breaking point, you probably don't want an "artist" to paint your living room walls.

Re: Programmers can’t write algorithms without help

#23
post #7
post #2

> Programmers can’t write algorithms without help And that might be a good thing. How often does a normal software engineer have to write bubble sort from scratch in his daily life? If someone from my team came to me telling me he had to sort an array and wrote bubble sort from scratch, then I'd probably not be very happy with that unless there is a really good reason to spend that time on it rather than using an exi…

I suppose that depends on what a programmer is asked to do. There are many roles and not all of them need the same thing regarding knowledge, computer science or abstract thinking. If you are in a position where you mostly do the same thing over and over inside a relatively complete framework for a managed or scripting language, you are unlikely to find yourself building data structures, algorithms or understand what…

Speaking as someone who has had to write performance critical data structures and also someone who does well with whiteboard interviews - there is a large difference between writing an algorithm with the advantage of having time to read, reason, and test your code and doing it on a whiteboard. There are many people who would do a fine job as a filesystem developer but might not be able to pass the interview for it.

The current situation benefits me personally in many ways, but I recognize that it's unfair to many other people.

Re: Programmers can’t write algorithms without help

#24

Earlier quoted context omitted.

I get your point, but why would you pick bubble sort? That’s one any engineer should be able to implement without any help. It’s the more complex/useful ones worth discussing. Even Obama knows this: https://m.youtube.com/watch?v=k4RRi_ntQc8

I picked bubble sort, because it's literally the example from the first sentence of the article: > David Hansson, the creator of Ruby on Rails, admitted in a tweet that he wouldn’t be able to write bubble sort on a whiteboard.

Oh my, I’m that guy today.

Whoever said it, I have a super hard time believing DHH couldn’t implement bubble sort on a whiteboard.

Am I the only one? I get that people hate whiteboard/algorithm interviews, but bubble sort?

  for i = 0..n:
    for j = i..n:
      if arr[i] > arr[j]:
        arr[j], arr[i] = arr[i], arr[j]
Everyone in this field should be able to do this, maybe not right away, maybe not without bugs, but with help within 45 minutes.

Re: Programmers can’t write algorithms without help

#26
post #2

> Programmers can’t write algorithms without help And that might be a good thing. How often does a normal software engineer have to write bubble sort from scratch in his daily life? If someone from my team came to me telling me he had to sort an array and wrote bubble sort from scratch, then I'd probably not be very happy with that unless there is a really good reason to spend that time on it rather than using an exi…

I've been a developer for almost 2 years (I know not that long) but I have never even heard of bubble sort. Looking it up, it is O(n^2). Is there a reason this is a common interview question? It doesn't seem like a sort one would ever really use, or at least it has very obscure uses.

I always thought merge/quick sorts accounted for 99.9% of use cases and only ever really learned about those.

Re: Programmers can’t write algorithms without help

#27
post #2

> Programmers can’t write algorithms without help And that might be a good thing. How often does a normal software engineer have to write bubble sort from scratch in his daily life? If someone from my team came to me telling me he had to sort an array and wrote bubble sort from scratch, then I'd probably not be very happy with that unless there is a really good reason to spend that time on it rather than using an exi…

I get your point, but why would you pick bubble sort? That’s one any engineer should be able to implement without any help. It’s the more complex/useful ones worth discussing. Even Obama knows this: https://m.youtube.com/watch?v=k4RRi_ntQc8

> That’s one any engineer should be able to implement without any help.

If I wrote it down every time someone claims that "this is so important any engineer should know it," I'd have a book as thick as the bible full of trivia. All of it so easy, and yet in every position you can find a person who hasn't mastered it all. Maybe it isn't all that important after all. Most of these people are capable of finding help should it come to that.

Re: Programmers can’t write algorithms without help

#28

Earlier quoted context omitted.

I picked bubble sort, because it's literally the example from the first sentence of the article: > David Hansson, the creator of Ruby on Rails, admitted in a tweet that he wouldn’t be able to write bubble sort on a whiteboard.

I wouldn't be able to write a bubble-sort specifically. But if I were asked to "sort" a set of numbers, I'm sure I'd come up with some unholy combination of bubble, selection, and insertion sort that got the job done. I always have to consult the books to remember the difference between bubble, insertion, and selection sorts. But even without documentation, surely people can write a list of numbers (ex: 9, 4, 5, 3, 2…

Mergesort is also worth looking into.

Re: Programmers can’t write algorithms without help

#29
post #23
post #7

Earlier quoted context omitted.

I suppose that depends on what a programmer is asked to do. There are many roles and not all of them need the same thing regarding knowledge, computer science or abstract thinking. If you are in a position where you mostly do the same thing over and over inside a relatively complete framework for a managed or scripting language, you are unlikely to find yourself building data structures, algorithms or understand what…

Speaking as someone who has had to write performance critical data structures and also someone who does well with whiteboard interviews - there is a large difference between writing an algorithm with the advantage of having time to read, reason, and test your code and doing it on a whiteboard. There are many people who would do a fine job as a filesystem developer but might not be able to pass the interview for it. T…

Yes, that is true. At the same time, most of those interviews are of course more about finding out how a person performs under pressure and how a person thinks rather than how well the white boarded shell sort for red-black trees with double-rot13 'encryption' would be usable in the real world.

At the same time I'd hope that we get better at asking questions rather than repeating the same nonsense in every interview. The more people we can work with, the better. Because maybe not everyone is a fit for the position we had in mind, but maybe a less complex position could be filled that way. Often the interviews are rather binary (due to it often targeting a vacancy instead of a workforce role) costs everyone involved much more than it ideally should.

Re: Programmers can’t write algorithms without help

#30

Earlier quoted context omitted.

I get your point, but why would you pick bubble sort? That’s one any engineer should be able to implement without any help. It’s the more complex/useful ones worth discussing. Even Obama knows this: https://m.youtube.com/watch?v=k4RRi_ntQc8

I picked bubble sort, because it's literally the example from the first sentence of the article: > David Hansson, the creator of Ruby on Rails, admitted in a tweet that he wouldn’t be able to write bubble sort on a whiteboard.

It's either an exaggeration, or his mind works in some very special ways.

You don't need to memorize multiplication table to be good at math, but this is an equivalent of saying "I wouldn't even be able to add two numbers together in my head!".

Post reply on HN