Live data from Hacker News

Ask HN: What is the big idea with algorithms?

news.ycombinator.com

1–10 of 28 posts

Ask HN: What is the big idea with algorithms?

#1
Firstly, I'm a non-CS major and am much unlike many of you mathematical whiz kids who make up this board, so having stated that, I hope you'll get a better idea for why this book I just checked out at the library, Algorithms in a Nutshell [http://oreilly.com/catalog/9780596516246/], gets me so hot.

To me algorithms are as interesting as the formulas that makeup our Universe brought to us from physicists, granted they're both inspired from the same basis, which is to express a set of quantities algebraically that hold true as a solution to a problem. However, physicists and computer scientists are both working towards opposite ends, since physicists attempt to generalize a set of observations from the physical world into a law, computer scientists attempt to materialize a set of observations from the abstract world into a set of instructions, called an algorithm.

When I open this text-book's ToC it reads like a road-map into the beginning of the mostly unknown Universe of computer programming. I want you to briefly summarize why algorithms are so important, where they came from [their genesis], how you use them on a daily basis, whether or not they're more important than design, and what the formulas of the future will do for humanity.

[EDIT] More bluntly, summarize [and categorize, if you'd like] the evolution of algorithm design starting with insertion sort and ending at your heart's content [or AI].

Re: Ask HN: What is the big idea with algorithms?

#2
It's a little hard to tell what you're really asking, so forgive me if this isn't what you're looking for. Worrying about algorithms in the "mathematical whiz kids" sense is extremely important when you have to be worried about speed and resources. Take databases, for instance. Their search and compression algorithms are extremely optimized (by mathematical whiz kids), and they yield phenomenal results. If everyone had always been satisfied with a simple, straightforward solution, Google would be devastatingly slow and require an enormous amount of space more than it already does.

I've had to look into the efficiency of my algorithms when doing batch processing on massive XML files - I managed to cut run-time by 80% by paying more attention to my algorithm's efficiency.

On the other hand, if I'm just sorting 5 entries alphabetically for some table, it's better to implement a quick-and-dirty algorithm that will take an extra 2 milliseconds to compute, than for me to spend half my day worrying about it's efficiency.

So generally speaking - people designing low-level systems are very worried about their algorithms, with good reason: If their code is slow or wasteful, their platform can't be used. If you're designing a web app, you'd probably waste more time than it's worth if you delve into that. It's just a question of priorities.

Re: Ask HN: What is the big idea with algorithms?

#3
Understanding algorithms and how to analyze them will make you a better programmer. Should you memorize every algorithm and clever trick that others have come up with? I haven't. However knowing that there are different approaches with various space/time trade offs gives me options to consider when coding something up. It also helps make me aware of the pitfalls of doing things a certain way.

Could I whip up a tree balancing routine on a whiteboard on command? No! But, I'm aware that such algorithms exist and what situation I'd need to apply them to.

I think this is what you should shoot for. As for Algorithms in a Nutshell, if it is the book I'm thinking of then bravo. I like how the authors chose to present the algorithms using code and not the awful psuedo-code found in most algorithms texts.

Re: Ask HN: What is the big idea with algorithms?

#4
post #3

Understanding algorithms and how to analyze them will make you a better programmer. Should you memorize every algorithm and clever trick that others have come up with? I haven't. However knowing that there are different approaches with various space/time trade offs gives me options to consider when coding something up. It also helps make me aware of the pitfalls of doing things a certain way. Could I whip up a tree b…

I think the space/time trade off is most interesting, given how impertinent it is in physics, and certainly constitutes a place for rethinking in how we approach mathematics and science on a whole.

Re: Ask HN: What is the big idea with algorithms?

#5
this suspiciously sounds like a final essay question for someone in college.

seriously, though, this is a pretty broad, abstract concept. an algorithm is, more or less, a set of instructions to solve a problem. they didn't have some sort of magical genesis, and everyone uses them on a daily basis.

Re: Ask HN: What is the big idea with algorithms?

#6
"I'm a non-CS major and am much unlike many of you mathematical whiz kids who make up this board"

Are there any math whiz kids on HN? (other than cperciva)

There are many smart people on HN, but I don't think there are math whiz kids. This is a hacker forum, not a math forum like AoPS. Sometimes we discuss stuff like complexity and algorithms, but most of the time, we rant on Ruby x Python or why kids these days want to build social networks for dogs instead of sending astronauts to Mars, or why big corporations are evil and small startups rock, or why PG is a supreme master and every single essay of his is nothing less than the truth. We are such cool kids we even have our own hacker-ghetto slang... including hideous terms like "ramen-profitable" ;-)

I know a forum where there's even a Fields medalist, and that is on quantitative finance. Whoever says that HN is made of math whiz kids probably knows very little math.

Re: Ask HN: What is the big idea with algorithms?

#7
post #5

this suspiciously sounds like a final essay question for someone in college. seriously, though, this is a pretty broad, abstract concept. an algorithm is, more or less, a set of instructions to solve a problem. they didn't have some sort of magical genesis, and everyone uses them on a daily basis.

School's out bucko, I wouldn't stoop that low. :D

This is more or less a metaphysical inquiry into where computer science is headed. Algorithms + data begets design patterns, design patterns + objects begets...

Re: Ask HN: What is the big idea with algorithms?

#8
Very simply some problems are impossible to solve in a reasonable amount of time or at all; these problems may looks simple, but their complexity can explode.

For instance chess is relatively easy to program where as go is quite a bit more difficult. ---------------------------------------

Here's a very good quote from wikipedia that might make it clearer:

The thesis is widely considered to be a good rule of thumb for real-life problems. Typical input lengths that users and programmers are interested in are between 100 and 1,000,000, approximately. Consider an input length of n=100 and a polynomial algorithm whose running time is n^2. This is a typical running time for a polynomial algorithm. (See the "Objections" section for a discussion of atypical running times.) The number of steps that it will require, for n=100, is 100^2=10000. A typical CPU will be able to do approximately 109 operations per second (this is extremely simplified). So this algorithm will finish on the order of (10000 ÷109) = .00001 seconds. A running time of .00001 seconds is reasonable, and that's why this is called a practical algorithm. The same algorithm with an input length of 1,000,000 will take on the order of 17 minutes, which is also a reasonable time for most (non-real-time) applications.

Meanwhile, an algorithm that runs in exponential time might have a running time of 2^n. The number of operations that it will require, for n=100, is 2^100. It will take (2^100 ÷ 109) ≈ 1.3×1021 seconds, which is (1.3×1021 ÷ 31556926) ≈ 4.1×1013 years. The largest problem this algorithm could solve in a day would have n=46, which seems very small.

http://en.wikipedia.org/wiki/Cobham%27s_thesis

Re: Ask HN: What is the big idea with algorithms?

#9
post #5

this suspiciously sounds like a final essay question for someone in college. seriously, though, this is a pretty broad, abstract concept. an algorithm is, more or less, a set of instructions to solve a problem. they didn't have some sort of magical genesis, and everyone uses them on a daily basis.

The timing seems right. Shouldn't have had that last beer...

Re: Ask HN: What is the big idea with algorithms?

#10
http://artemis.cs.yale.edu/classes/cs460/Spring98/contents.h... is a very good resource on the parent science of algorithmic information theory.

AIT and computational complexity theory arguably underlay all other sciences. They allow us to define randomness (http://www.cs.auckland.ac.nz/~chaitin/georgia.html), pattern, probability (http://www.scholarpedia.org/article/Algorithmic_probability), inference (http://www.wisegeek.com/what-is-solomonoff-induction.htm), ignorance, and perhaps one day consciousness.

They allow us to prove, with absolute certainty, whether we are talking to a deity ( http://scottaaronson.com/blog/?p=56), and to prove that some questions will forever be beyond our grasp.

Even discounting Zuse and Wheeler's "It's from Bits" conception of information and computation as the basis of physics (http://en.wikipedia.org/wiki/Digital_physics), these disciplines promise to help us solve our hardest and most interesting problems by, first of all, telling us whether they are solvable at all, and if so, whether they are solvable before the heat death of the universe. Consider that Goedel, Cohen, and Turing struck down the Continuum Hypothesis from Hilbert's list of open problems, allowing us to abandon a futile line of inquiry and focus on other problems. Current developments in quantum computability theory may similarly strike down vast swathes of sterile ideas, directing us toward questions whose answers are solvable.

Post reply on HN