Live data from Hacker News

Ask HN: What are your favorite algorithms?

news.ycombinator.com

91–93 of 93 posts

Re: Ask HN: What are your favorite algorithms?

#91

Earlier quoted context omitted.

Any laymen explanation ? Not able to grasp the concept.

It does two things concurrently: (1) search for an algorithm along with proofs for its correctness and time upper bound (2) run the fastest algorithm found so far, possibly aborting an slower algorithm when a faster one is found. Everything is scheduled so it's asymptotically optimal. However, there's an added cost to search for algorithms. This cost is exponential in the proof length, but constant for each problem s…

Funny thing is, you can offload most of this to compile time, which is what Isabelle is doing, but then you miss out on guaranteed optimal runtime. Also the proof database may not be complete anyway.

Re: Ask HN: What are your favorite algorithms?

#92
post #34

Given the head of a linked list, how do you determine if it loops? eg, an l-shaped list is easy to determine - you simply process each element in the list until you find one without a subsequent element. But what if it's a 9-shaped linked list? You'll never run out of elements, so the best you could seem to do would be to store a reference to each element and check against all references to see if you've found a dupl…

Just ran it through on the office whiteboard, colour me impressed, really novel!

Did have to remind myself to start the double-jumper off before the single-pointer to prevent a short-circuit, but that's a great solution to cyclical lists.

Where did you learn about this?

Post reply on HN