Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

We use bubble sort as a kind of FizzBuzz test. Sorry, but we have to verify that you can actually write code. We can't go further without it.


Ok who here over five years out of school remembers bubble sort?

Give me the Wikipedia article and I could code it in five minutes but I just don't remember the specifics of the algorithm. Does that really make me a bad hire?


I do, and school was a frighteningly long time ago. As a clue, I think the last language I coded it in was Fortran II.


Of course we will tell you how it is supposed to work.


Ok you're cool then :-).


Will you provide the bubble sort algorithm if asked? The first comment on this post also says they ask search questions as a FizzBuzz filter, but unless you will provide the algorithm then you're also asking it as an algorithms question.


You can't do bubble sort off the top of your head?


I'm not honestly sure I can. I can certainly do merge sort and a really naive quicksort, but bubblesort's not something I've ever written, nor have I even seen a description of the algorithm since my freshmen year of college or earlier. The name isn't exactly descriptive, so if I were asked to implement it I'd probably take my best stab at it and wind up implementing some other O(n^2) sort. Does that make me a bad programmer?


If you can do any real sort algorithm in real code off the top your head, bubble sort shouldn't matter, and any interviewer who punts you for that is interviewing for a job you don't want.


I can do insertion sort off the top of my head, because I find it very intuitive.

Bubble sort always seemed odd to me, and since I can remember insertion sort, if I ever found myself in the odd position of having to write a sort for a program without any reference materials, I'd just use insertion instead.


From looking it up on Wikipedia I found out that I would've remembered it, but it was around 15 years ago that I last wrote one myself. So I would've had to ask if it was the one where you iterate over the values and keep the largest, then repeat. I've learned these at the same time as the other generally known sorting algorithms, so names and details are quite fuzzy.

It probably depends on the position. As a high-level language developer I don't usually implement my own sorting algorithms. Either I use prebuilt libraries that offload work to low-level, or I use builtins, or I ask the database to sort it for me :)


Yes we would. I always wonder what to do when I receive three identical follow-ups. Answer three times?


If still within the window, you could just add an "edited:" to your comment including that information.


Nobody will be notified of my edit.


right, but you can at least hopefully prevent other people from asking. Comment Triage.


That's somewhat odd... I've worked at some big companies and some small companies, and have never, ever been asked to code a bubble sort, either in interviews nor has it ever come up in production. Ever. I've been doing this professionally for coming up to 20 years (full-time professionally for 17, part-time before that). I'd possibly fail your interview. I wonder how I've survived in software development this long. That's not a snarky question either.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: