Earlier quoted context omitted.
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.
Bubble sort is good for two reasons. First, it's so easy that anybody should be able to remember how to do it. Second, it's slow and everybody should know that and be able to point it out. It's actually usable for small enough n. I once coded it when I expected n to be 4 or less, and I'm sure the person who replaced it cursed my name when that expectation turned out to be false.
Programmers can’t write algorithms without help
51–60 of 105 posts
Re: Programmers can’t write algorithms without help
#52Shouldn't be a surprise; the person who wrote the algorithm without help took more than 15 minutes, and got a paper or a PhD out of it.
Re: Programmers can’t write algorithms without help
#53If you don't remember bubblesort the interviewer could explain what the algo does and then you should be able to implement it. I'm all for looking stuff up on the web and we all have phones in our pockets but if there's to be a minimum bar it shouldn't be lower than bubblesort.
Re: Programmers can’t write algorithms without help
#54Earlier quoted context omitted.
Bubble sort is good for two reasons. First, it's so easy that anybody should be able to remember how to do it. Second, it's slow and everybody should know that and be able to point it out. It's actually usable for small enough n. I once coded it when I expected n to be 4 or less, and I'm sure the person who replaced it cursed my name when that expectation turned out to be false.
For a simple sort you can use for small N, I'd suggest insertion sort. Its constants are better, it performs well on almost-sorted input, and I think it's even easier to implement, personally.
Re: Programmers can’t write algorithms without help
#55Re: Programmers can’t write algorithms without help
#56Whenever this comes up, I can only assume that people are talking about very different sorts of technical interviews than I’ve ever been subject to. I’ve been working as a programmer for 25 years now and must have been through at least two dozen technical interviews in that time (one just a couple of years ago) and I’ve never had this level of pedantry thrown at me. It sounds like the poster has been rejected from a…
The flip side is that in mature companies like the one I work for, where professional interviews are more of the rule, we don't get the best candidates, at least not right now. I could imagine that super attractive startups can afford to set the bar higher and still get enough applicants.
Re: Programmers can’t write algorithms without help
#57Earlier quoted context omitted.
Mergesort is also worth looking into.
Strangely enough, I always found quicksort easier to write than Mergesort. But that's probably just how my mind works. Hmmm... with Mergesort, you gotta be copying the data to new buffers, malloc-ing arrays and new arrays, managing the data etc. etc. Quicksort can be trivially done in-place. And yes, I know Merge-sort has an in-place variation, but in-place Mergesort is non-intuitive IMO. ------- I guess merge-sort i…
Re: Programmers can’t write algorithms without help
#58String length in Python is maybe too much exaggeration unless someone hasn’t wrote Python for a long time. But, algorithms? Sure! Nobody remembers them for ever. Often you at least need to read how the algorithm works before implementing it. Obviously for most devs it is faster to just search for a sample implementation or a pseudocode.
Or they use several languages. Say you have client side code in JavaScript, with the client served by PHP on the server. You've got some log analysis scripts in Perl. You've got some SOAP services in Java. You've got some machine learning stuff in Python. You've got a mobile app in Swift.
It's real easy to get confused about which of foo.length, strlen($foo), length($foo), foo.length(), len(foo), or foo.characters.count is the right one for the language you are dealing with at the moment.
Re: Programmers can’t write algorithms without help
#59Yet another article showcasing how the tech interview process is fundamentally flawed. Personal anecdote: I recently underwent an interview process for a position in my field of expertise (computer vision) consisting of multiple in-person stages, whiteboard coding, product design and a take-home assignment that required developing a foundational (bubble-sort like) algorithm from scratch. After successfully completing…
In the other side, I always pitch "We do this or that, this is what we need help for, and this is how much we can pay (or: how much is your rate?)".
Is an amazing filter. Specially when you don't have much cash to give. Because: If I can't pay... why lost more time? And if I can pay and the other accept it.. only need to solve if is capable.
This is also for my customers. I put a money estimate as soon as possible, or ask upfront what is the budget range.
Is an amazing filter. Because: If I the customer can't pay... why lost more time? And if can pay I only need to solve why I'm a good fit.
The less hidden variables the better for all...
Re: Programmers can’t write algorithms without help
#60Whenever this comes up, I can only assume that people are talking about very different sorts of technical interviews than I’ve ever been subject to. I’ve been working as a programmer for 25 years now and must have been through at least two dozen technical interviews in that time (one just a couple of years ago) and I’ve never had this level of pedantry thrown at me. It sounds like the poster has been rejected from a…
These kinds of anecdotes make me often wonder if candidates are "disqualified" for far more superficial reasons, and if interviewers hone in on pedantry like this to legitimize their reasoning perhaps even unconsciously. I have trouble believing most candidates wouldn't make at least one trivial mistake of that sort and I am equally reluctant to believe the same interviewers would disqualify any given candidate for a mistake so trivial.