I know what you must be thinking based on the title. I wanted a post title that is concise and descriptive of my exercise today.

Quite a while back ago, I came across a podcast of Paul Graham's speech titled "Great Hackers" at OSCON 2004. In a nutshell, he discussed what makes a great hacker and amongst other things, the importance of software developers (or hackers) to have idols to look up to. That got me thinking about other professions.  In particular, pro sports. And in my thought path somewhere, I began thinking about hockey idols. Part of why NHL players are so good at what they do is because of repetition.  Joe Sakic, an NHL sniper best known for his patented wrist shot, used be locked away in his basement doing nothing but take wrist shots all day.  Obviously, you have to take conditioning and athletic ability into the mix.  Now, back to programming.  In software development, it should be no different.

Sure, you can claim that you are practicing programming when you are at work and developing away.  But is that really practice?  If we draw back to the NHL analogy, it would seem more like "game-time" situations than anything.  So when do we come up with the time for practice.  Well this is why, with as much regularity now, I try to do Quick BrainSharpeners.

One classic problem that came up today was the following:

Find the maximum sum subsequence of an array of integers.

Solution:

    public int LargestSum(int[] numbers)
    {
        int maxSum = numbers[0];
        int currentMaxSum = numbers[0];
       
        for (int i = 1; i < numbers.length; i++)
        {
            currentMaxSum = numbers[i] + Math.max(0, currentMaxSum);
            if (currentMaxSum > maxSum)
            {
                maxSum = currentMaxSum;
            }
        }
        return maxSum;
    }

Some people will think of recursion using a divide and conquer algorithm.  But what you will end up with is a nlogn time complexity.  This is actually a linear time problem. You can extend this problem beyond this and add things like having the problem ask for the starting and ending indices of the max sum subsequence. 

It is my hope that one day, I will have well inter-connected neurons firing at all times.  Then, I may be ready for the playoffs =).


RANDOM THOUGHTS:

http://www.forbes.com/video/?video=fvn/business/ms_sap101906 - SAP's CEO discusses market share.  Good Humour.  Le "Larry Ellison" sandwich.  Also, you have to love good analogies.

http://www.microsoft.com/windows/ie/default.mspx - I didn't get a chance to blog about this when it was fresh news (i.e. Wed18th).  For professional purposes, I was eyeing the international versions with more interest (http://www.microsoft.com/windows/ie/worldwide/default.mspx).  In any case, I haven't been living in a cave (or at least not entirely).  I probably just won't be blogging about this somewhat ties in with what I've touched on.  Perhaps it would be appropriate to write about once it is out in the public domain.  Looks like IE7 has been well-received thus far (http://news.zdnet.com/2100-9588_22-6127277.html?tag=nl).  We'll have to see how the "high-priority" upgrades go (http://news.zdnet.com/2100-1009_22-6098500.html?tag=nl).

It seems that most of the good examples of web 2.0 mashups from startup organizations are in the real estate industry/niche.  Whether it is predicting house values (www.zillow.com) or providing a different twist to your traditional MLS listings (www.redfin.com).  Thinking back to the real estate anecdotes from my parents, in a different era and country, buying property back then was like trying to pick out a pair of matching socks in the dark.  Now, all this information is available.