News for hackers. Stuff that matters.
Re:The Programming Interview from Hell by kppiskingpp on Monday February 20, 2017 @09:48AM (#13687647)
linked list is not complex for christ sake.
Re:The Programming Interview from Hell by mankyd on Monday February 20, 2017 @10:02AM (#13687811)
Tell that to the 1000's of people who can't implement them.

I agree, its not that hard, but that's all the more reason to avoid giving attitude about the question. Answer it quickly and move on. If you can't answer it quickly, maybe it _is_ that complex.

A lot of interviewers have a short time window in which to conduct their 1-on-1. Sometimes they ask easy questions for a reason.

Often, I start with a soft ball that I intend on building on - turn a linked list into a doubly linked list; a circular list; can you improve the lookup time; can you make it generic; what are the space constraints; what are the time constraints.

And if they can't answer the simple question, we just leave it at that.

A simple question can easily be built upon. "I'd Google it" can not.

Re:The Programming Interview from Hell by yunolisten on Monday February 20, 2017 @10:02AM (#13687808)
> linked list is not complex for christ sake.

There are many people for whom this is complex, you're assuming a foundation that not everyone has. There are also many people for whom nothing is complex, they assume they can understand everything, while they don't currently, they assume they'll be able to learn it without issue.

Dealing with new starts who are straight out of education is often like reading posts from 4chan.org/b, at first you don't know if they're joking.

It's not all doom and gloom, occasional I'm pleasantly surprised by the calibre of those beginning their career/hobby, but this is the exception.

Re:The Programming Interview from Hell by latch on Monday February 20, 2017 @10:43AM (#13688169)
But there's also nothing crazy about a company saying: for this role, we expect the candidate know linked lists. It's not esoteric and I think a lot of us would consider normal programmers who have had to write linked lists (and other data structures) for one reason or another.
Re:The Programming Interview from Hell by yunolisten on Monday February 20, 2017 @11:03AM (#13688324)
Personally I agree, however I know people employed to code PHP who have no concept of this. Some apprentices who have left college have joined our company who don't know this.
Re:The Programming Interview from Hell by base698 on Monday February 20, 2017 @09:53AM (#13687705)
I think the original intent of the linked list question was to see if the candidate knew pointers. Implementing in a non pointer language would be trivial and definitely not complex.
Re:The Programming Interview from Hell by Apocryphon on Monday February 20, 2017 @02:14PM (#13690011)
Are linked lists even a difficult example of pointer use? You don't exactly have to do fancy pointer arithmetic with them. You just have to be a little bit careful when inserting or deleting nodes.
Re:The Programming Interview from Hell by gpderetta on Monday February 20, 2017 @04:31PM (#13691128)
You do need to understand the difference between an object and a refrence to it. Seems trivial bit surprising many programmers seem not to understand it.
Re:The Programming Interview from Hell by StreamBright on Wednesday February 22, 2017 @03:22AM (#13704055)
No it is not. However, it is totally irrelevant for 99% of jobs require programming skills. Being 15 years in this business I haven't seen linked lists being used for any particular problem, but I understand that when you work in the right industry it is invaluable. If I had to implement it I would probably use a library and I would educate myself on the subject. I usually find programmers running into many other issues that don't show up during interviews.

Few questions I usually ask:

- How can you make sure that your Java application runs on the server not only on your laptop? (I take any answers: containers, single JAR, etc.)

- What is printed out

def add_list(val, list=[]):

    list.append(val)

    return list
print add_list(10)

print add_list(20)

print add_list(123,[])

- Explain recursion

Funny to see how a non-trivial amount of programmers fail to answer these questions.

Re:The Programming Interview from Hell by btschaegg on Tuesday February 21, 2017 @06:45AM (#13694853)
> linked list is not complex for christ sake.

...unless you need them for lock-free programming. There was a nice C++ talk by Herb Sutter on that, with the apt title "Juggling Razor Blades". That pretty much says it all.

From a practical standpoint, the question "what is a linked list good for?" really might be more interesting. Does anyone know of potential use cases besides kernel design, lock free programming or Clojure-style immutable datastructures? I'd guess CPU caches to have erradicated most of them...

Re:The Programming Interview from Hell by golergka on Monday February 20, 2017 @10:34AM (#13688076)
Have you ever hired developers? FizzBuzz is still a very effective filter.
Re:The Programming Interview from Hell by scarface74 on Monday February 20, 2017 @12:48PM (#13689277)
At my last job, we asked two simple questions and many "senior developers" couldn't get them:

1. Write a function that determines if a number is prime. If they didn't know what a prime number was, we would tell them.

2. A simple problem that required designing a database schema and sql query that involved a left outer join.

There were a lot of developers who couldn't do it.

On the other hand, there was one developer who was just learning c#, who had spent most of his time doing VB.net, couldn't answer a lot of the technical questions but we could tell by his thought process and how he explained real world problems he solved that he would be a great asset to the company. We fought for him over more "senior" developers.

When I have a chance to hire again, I'm going to fight to get him -- even though he sucks at interviewing and i might have to do a little convincing.

Re:The Programming Interview from Hell by flukus on Monday February 20, 2017 @06:30PM (#13691968)
> Write a function that determines if a number is prime. If they didn't know what a prime number was, we would tell them.

Did you also give them an algorithm to implement or was a brute force method good enough?

Re:The Programming Interview from Hell by scarface74 on Monday February 20, 2017 @07:56PM (#13692383)
First the brute force algorithm. Then we would ask them how could they optimize it. A lot of people couldn't even get to the brute force algorithm.

1st level optimization: skip even numbers.

2nd level optimization that I was the only person to get when I had to interview for the company: loop starting at 2, and go the square root of the argument.

Re:The Programming Interview from Hell by falcolas on Monday February 20, 2017 @01:02PM (#13689395)
They can be. Doubly linked lists. Intrusively linked lists. Ring buffers. Linked Lists optimized for storage in CPU caches. B Trees (stretching the definition a bit). And so forth.
Re:The Programming Interview from Hell by onion2k on Monday February 20, 2017 @10:37AM (#13688103)
linked list is not complex for christ sake

That depends on the language. If you're using something without pointers or references it's quite hard.

Re:The Programming Interview from Hell by ldarcyftw on Monday February 20, 2017 @11:13AM (#13688419)
Hmm, which (general) language has no pointers or references?
Re:The Programming Interview from Hell by falcolas on Monday February 20, 2017 @01:00PM (#13689377)
Python. Ruby. Javascript. Lisp. Haskel (IIRC).

They all use them internally, but don't tend to make them available to the programmer (usually because they aren't needed).

Re:The Programming Interview from Hell by gpderetta on Monday February 20, 2017 @01:10PM (#13689480)
They have references (at least python, lisp that I know of, likely the others as well), which is enough to implement linked lists.
Re:The Programming Interview from Hell by falcolas on Monday February 20, 2017 @02:15PM (#13690025)
The ability to implement linked lists != pointers and references

Behind the scene, yes, every Python variable is a reference to an object. It's not addressable, however, and in the case of immutable objects (like strings), you can't modify the underlying object and keep all references pointed at that updated object.

Re:The Programming Interview from Hell by gpderetta on Monday February 20, 2017 @03:37PM (#13690675)
If have references you can pretty much always implement lists. First all you do not need mutability, you can implement linked lists form immutable cons cells, second python has mutable references so implementing linked lists is trivial (the fact that some objects are in fact immutable is immaterial).
Re:The Programming Interview from Hell by ldarcyftw on Monday February 20, 2017 @01:16PM (#13689528)
Well, at least in Ruby and Javascript variables are references to objects and it is trivial to implement a linked list in both.
Re:The Programming Interview from Hell by buserror on Monday February 20, 2017 @10:00AM (#13687791)
No, AND they are actually useful for any sort of problem, like, reading a records from a file and that sort of stuff. Heck, I wrote one last week [0] because it's quick to implement and does the job. Same applies for the double-linked kind (slightly less so but still nice) and queues. One of my favourite linux kernel header is lists.h!

[0]: https://github.com/buserror/rf_bridge/blob/master/src/rf_bri...