This is a bad interview question. It involves "rediscovering" a named algorithm on the fly, over the phone OR already knowing about it an acing it which is disingenuous on the part of the interviewee, or telling the truth that you know it and moving on to an equally bogus question. In the spectrum of questions, this one is near yes or no. Good questions might start with, "how would you implement a system to ..." or "…
The Tortoise and The Hare: Loops in Linked Lists
11–20 of 20 posts
Re: The Tortoise and The Hare: Loops in Linked Lists
#12This question seems to come up often enough. It came up in an interview I did a little while ago; I was delighted since I am a big fan of the Tortoise and the Hare algorithm (I think I originally read about it in The Connection Machine by Hillis, which is a great read in general). I think it's a good interview question even if you're not familiar with it, because while you might not come up with the algorithm, it sho…
Re: The Tortoise and The Hare: Loops in Linked Lists
#13Added in edit below - I do like the write-up and have up-voted it! Another edit: Did you get the job? Or the next interview? Another post about an old friend. Note that this version is the more common Tortoise and Hare, rather than the Teleporting Turtle[0] version (also known as Brent's Algorithm[1]) that, under some distributions, can be faster. [0] https://news.ycombinator.com/item?id=1068715 [1] http://en.wikiped…
Re: The Tortoise and The Hare: Loops in Linked Lists
#14A good follow on from finding whether there is a cycle is finding the length of the lead-in and cyclic parts of the list, and then implementing a map function over cyclic lists. There are some interesting tricks that rely on non-obvious properties of cyclic lists.
Re: The Tortoise and The Hare: Loops in Linked Lists
#15This is a bad interview question. It involves "rediscovering" a named algorithm on the fly, over the phone OR already knowing about it an acing it which is disingenuous on the part of the interviewee, or telling the truth that you know it and moving on to an equally bogus question. In the spectrum of questions, this one is near yes or no. Good questions might start with, "how would you implement a system to ..." or "…
I said: "I would use grep"
so he asked, what if i also need to find attributes and some other stuff i can't remember.
I said: "ah okay, in that case I would use a document store, like eXist"
He asked: "but would it be faster than our competitors?"
i start thinking how the hell would i know, and said: "i'd get something running, and then think about how we can optimize it afterwards"
why the hell would i design a database system from scratch? needless to say he didn't really like what i had to say.
Re: The Tortoise and The Hare: Loops in Linked Lists
#16This is a bad interview question. It involves "rediscovering" a named algorithm on the fly, over the phone OR already knowing about it an acing it which is disingenuous on the part of the interviewee, or telling the truth that you know it and moving on to an equally bogus question. In the spectrum of questions, this one is near yes or no. Good questions might start with, "how would you implement a system to ..." or "…
it's funny you say that. i once had an interview question from a bank saying how would you create a system that can find certain things in large xml documents faster than our competitors. I said: "I would use grep" so he asked, what if i also need to find attributes and some other stuff i can't remember. I said: "ah okay, in that case I would use a document store, like eXist" He asked: "but would it be faster than ou…
Re: The Tortoise and The Hare: Loops in Linked Lists
#17This is a bad interview question. It involves "rediscovering" a named algorithm on the fly, over the phone OR already knowing about it an acing it which is disingenuous on the part of the interviewee, or telling the truth that you know it and moving on to an equally bogus question. In the spectrum of questions, this one is near yes or no. Good questions might start with, "how would you implement a system to ..." or "…
it's funny you say that. i once had an interview question from a bank saying how would you create a system that can find certain things in large xml documents faster than our competitors. I said: "I would use grep" so he asked, what if i also need to find attributes and some other stuff i can't remember. I said: "ah okay, in that case I would use a document store, like eXist" He asked: "but would it be faster than ou…
Re: The Tortoise and The Hare: Loops in Linked Lists
#18This is a bad interview question. It involves "rediscovering" a named algorithm on the fly, over the phone OR already knowing about it an acing it which is disingenuous on the part of the interviewee, or telling the truth that you know it and moving on to an equally bogus question. In the spectrum of questions, this one is near yes or no. Good questions might start with, "how would you implement a system to ..." or "…
OP, best of luck on the rest of the interview process!
Re: The Tortoise and The Hare: Loops in Linked Lists
#19Re: The Tortoise and The Hare: Loops in Linked Lists
#20This is a bad interview question. It involves "rediscovering" a named algorithm on the fly, over the phone OR already knowing about it an acing it which is disingenuous on the part of the interviewee, or telling the truth that you know it and moving on to an equally bogus question. In the spectrum of questions, this one is near yes or no. Good questions might start with, "how would you implement a system to ..." or "…
it's funny you say that. i once had an interview question from a bank saying how would you create a system that can find certain things in large xml documents faster than our competitors. I said: "I would use grep" so he asked, what if i also need to find attributes and some other stuff i can't remember. I said: "ah okay, in that case I would use a document store, like eXist" He asked: "but would it be faster than ou…