What is an algorithm?

Posted on Wednesday 30 May 2007

We all use algorithms every day, but what is an algorithm, exactly? By my definition, an algorithm is a formalized procedure to accomplish a task (this is essentially the same as Wikipedia’s).

Not everything you do is an algorithm. Some things we do have no known good algorithm, such as writing a blog entry. On the other hand, there’s an algorithm out there to write computer science papers. Other things do have an algorithm but we typically don’t explicitly use one. For example, when I vacuum a carpet, I generally don’t think about how to cover the area using the minimal amount of effort, I just do it.

An algorithm exists for any problem which we can state formally, as long as there is a finite search space. In this case, we can always “try all possibilities”. Prolog will do this for you, but not necessarily very efficiently. The fun comes when we want to create the most efficient algorithm possible according to some metric.

A key feature of an algorithm is that it’s deterministic. That is, given exactly the same input, it will always give the same output. I’m almost fibbing: some algorithms use randomness. The most frequently used of these is probably quicksort, a method of sorting which uses randomness to help it divvy its work into roughly equal piles. However, we may view the random stream used by this process as a part of its input. Given the stream, we know exactly how the algorithm will execute. When we prove the correctness of a random algorithm, we assume that the random string is drawn from a certain distribution.

Sometimes it’s hard to tell if something you do has an algorithmic basis. Is how much you love someone determined algorithmically? Some people believe that the universe itself is governed by an algorithmic process. This concept is sometimes known as digital physics. In that case, love, hate, and everything under the sun is the product of an algorithm. If this were true, I would argue that it wouldn’t detract from the universe’s beauty, richness, or importance, any more than the physical medium of a painting detracts from the painting itself.

Most scientists, I think, believe that the totality of the rules behind the universe are describable. But it’s well known that it’s impossible for the state of the universe to be observed. The Heisenberg uncertainty principle is another example of this: you can’t know both the exact position and velocity of a particle.

But suppose we somehow had the whole state of the universe. There’s still something else: the information which we get every time we observe certain quantum phenomena, such as the spin of an electron. What if this stream were completely unknowable until after the fact? This could very well be the case if the many-worlds interpretation is correct. Essentially, every time the universe needs a “random” bit, it splits into two universes; which universe you perceive yourself in is completely arbitrary. This means that even if the rules behind the universe are fixed and even if all possible information is revealed to you, its behavior is not predictable, not even in a statistical sense. Can we still call it an algorithm?

At this point, it all becomes a little too philosophical for me to bother with. There are too many interesting, concrete algorithms out there for me to spend much time on this topic.


20 Comments for 'What is an algorithm?'

  1.  
    Thimble
    June 5, 2007 | 7:52 am
     

    actually, i do think that we do use an algorithm to clean our carpets or else we’d be vacuuming very inefficiently…

    here’s a determinalistic way of looking at the universe: if every action is the result of every previous reaction -> contrarily, no one thing is the result of a previous one thing ->, is the universe running on algorithms? or is it just one massive action after one massive action?

  2.  
    DiegoAndresJAY
    June 5, 2007 | 9:49 am
     

    I like your blog so far. I’m looking to further enhance and clarify your definition of an algorithm (since that is what this entire blog is about).

    You state, “Not everything you do is an algorithm. Some things we do have no known good algorithm, such as writing a blog entry…Other things do have an algorithm but we typically don’t explicitly use one. For example, when I vacuum a carpet, I generally don’t think about how to cover the area using the minimal amount of effort, I just do it.”

    While you seem to focus on the lowest level of scope, algorithms can come in different levels of scope. Why can’t you say there is an algorithm for writing a blog? After all, you can’t submit the post until you’ve written it, and you can’t write the post until you’ve selected a topic to discuss.

    The same would go for vacuuming; the algorithm could include getting the vacuum to the room, plugging it in, vacuuming (a which point you could refer to a more specific, but differnet algorithm that discusses how the vacuuming should occur), cleaning the bag, storing the vacuum, etc. You may not have an algorithm for vacuuming each room, but I bet when you vacuum your house you don’t vacuum one room upstairs, then one downstairs, then back up (you get the idea).

    While an algorithm strives to be the most efficient it can, other algorithms that aren’t as efficient aren’t any less of an algorithm; they just aren’t sought out. Just because the way you vacuum a certain room changes from month to month doesn’t mean there isn’t an algorithm. I would compare that to the cards that are moved during a shuffling algorithm, the process didn’t change, but which cards were switched in each iteration did.

  3.  
    July 22, 2007 | 3:06 am
     

    Brown…

    In few years we will see a result…

  4.  
    October 3, 2007 | 2:03 am
     

    f479dc90f15ea3db722c…

    f479dc90f15e…

  5.  
    October 6, 2007 | 7:59 am
     

    buy levitra…

    Wie Ihren Artikel zu Digg inzuzufügen?…

  6.  
    November 1, 2007 | 2:55 am
     

    online casino…

    I wanted add your site to my blog……

  7.  
    November 27, 2007 | 1:47 pm
     

    No Fax Pay Day Loan…

    I assume that board chairs who visit Buffalo once and again accede payday loans…

  8.  
    December 19, 2007 | 7:30 am
     

    pxamsjiu…

    pxamsjiu…

  9.  
    January 14, 2008 | 8:48 pm
     

    Multifamily Portfolios Carry $225M Asking…

    Three are located in South Fort Myers, including the 360-unit Park Crest at the Lakes, the 320-unit Beach Club and…

  10.  
    January 16, 2008 | 9:01 pm
     

    IRS multiplies easements’ pitfalls -…

    Three organizations purchased the Irbys’ easements in a bargain sale: Great Outdoors Colorado paid $178000; the US Department of Agriculture-Natural…

  11.  
    January 21, 2008 | 1:07 pm
     

    Job scam hits FC company…

    The Better Business Bureau staff notified AMG and provided them with the e-mail address and phone number provided on the…

  12.  
    February 9, 2008 | 8:35 pm
     

    payday loan illinois…

    The best source for quick cash advance and payday loans online….

  13.  
    March 21, 2008 | 3:32 pm
     

    Carpets & Rugs…

    Could you be more specific on what it is you done? thanks….

  14.  
    April 22, 2008 | 3:02 am
     

    Rug Lover…

  15.  
    May 10, 2008 | 7:52 am
     

    975f47db92c5…

    975f47db92c5cb4cff8a…

  16.  
    July 13, 2008 | 2:26 am
     

    Nevada carpets listings…

    […] the situaion that performance-based ministry pay creates, because if every church did this, we’d be clamoring over each other, trying to pull as many bodies in the door as possible. This negates the way Jesus operated, with […]…

  17.  
    July 18, 2008 | 11:42 am
     

    quick no fax cash advance…

    (Blogger now has backlinks - very similar to the trackback feature in Movable Type.A Trackback is one of three types of Linkbacks, methods…

  18.  
    July 27, 2008 | 5:15 am
     

    Cash Advance Loan Online Quick Cash Advance Loan Cash…

    Can it be that your server is infected with a virus - I get an Virus warning when I open your site with Firefox - Just for your Info….

  19.  
    August 8, 2008 | 11:30 pm
     

    Car Loan…

    Take advantage of an auto loan to be able to buy a brand new Bentley in ten hour by engaging in a incomparable society!…

  20.  
    August 25, 2008 | 7:13 pm
     

    48b366a9e1…

    48b366a9e1…

Leave a comment

(required)

(required)


Information for comment users
Line and paragraph breaks are implemented automatically. Your e-mail address is never displayed. Please consider what you're posting.

Use the buttons below to customise your comment.


RSS feed for comments on this post | TrackBack URI

Powered by WP Hashcash