Wednesday, May 9, 2007

Why algorithm or algo ?

I am quite interested in figuring out the patterns and algorithms behind a solution or a process .

Fundamentally believe that for many things, there is a method .
The expert ( experienced, master, talented ) uses the method consciously or tacitly . The person at the beginner or intermediate level is awed by the knowledge in initial stages and later strives to get to the method .

The person who cracks the algo rises above the extra-ordinary . He will be on a firm ground
to tackle the future challenges. To become a better person , I have this eternal quest for " algo" and which is a key driver for my writings.

To demonstrate the power of algo, consider the below example.

If x = 3 to power of 22 and y = 6 to power of 65, what is the remainder when xy is divided by 10?

To a layman, the above question might be tough inspite of having good maths background.

Whereas, the trained mind can observe and generalize a pattern .

Solution :
6 to power of anything always ends in 6.
3 to power of anything has a pattern - the numbers end in 3, 9, 7, 1,
So multiplication of units in both x and y result in a pattern - the unit digits of results will be cyclic - 8, 4, 2, 6 .

With the knowledge of basic maths , but more importantly figuring out the Pattern, this problem can be solved in a minute.

Consider the repertoire of skills required in different categories

  1. Intelligence tests
- mathematical , verbal, spatial, logic, pattern recognition, visualization, classification

2. Creative
As per Edward De Bono , the Guru of creative thinking, we could add more to the list -
lateral thinking, out of box thinking , innovation etc.

3. Professional
- Planning , communication, execution , analysis, time management, inter personal skills etc.

One could summarise the above in two words - Analysis and Execution.

Here the word analysis is a on a broader level like understanding , but also spans the concepts of synthesis , innovation etc. What about spiritual , emotional intelligence, value system?
The word "analysis " falls short .

Hence we could say - Mind and Action.

Most of the things are being done by our mind and by our body .
By "Action" , we could include things of physical aspects - eye-hand coordination, reflexes, verbal communication, fitness , sports intelligence etc.

With this simplification(synthesis or summation) algo , there are only 2 things to consider .

Having said that, let's explore how the different algos can be used from now on in both mind and action domains.

For now , a small snippet in mind domain.

Consider the challenges faced by a Java Architect and a Retail (Deli/grocery) shop keeper .
Both of them have to address space limitations and seek optimizations.

One is concerned about the design of how to get large Objects to realization only when they are needed. ( Uses Lazy instantiation).

The other orders the stock just before the inventory levels are down or when there is a near future demand ( festival etc).

The algo used both by experienced techie and by the average Joe is " get it when you need it or else it's redundant and causes overhead " .

There are many such similarities in business and in technology . The underlying algos remain same .

And that's interesting ..