Algorithm Strategies for Success!

Recently I was creating study material on algorithm strategies (in computing). While preparing, I realized that algorithmic strategies can be mapped to success strategies for life! Hmm, that’s really an interesting perspective and can make for a fun thought experiment. So, here we go.

Brute force strategy

Trial and error is the mechanism that most of us start with when we want to achieve something. I remember early days when I was searching for a job (in 2002). The idea is to try anything and everything. Check newspapers, try uploading resumes in job search sites, check with your network, … whatever comes to my mind to get a job, I would try that.

Brute force – given time and energy – often works. Of course, brute force is better than “no strategy”. No strategy is “wishful thinking”: hoping that we will get a magic email popping in our inbox congratulating us for the job in an MNC with fat CTC, with attachment on joining instructions!

The problem with brute force is that it wastes energy, time and effort. The success rate or hit rate can be really low. Everyone starts with trying out a brute force strategy and it is important to learn why it isn’t effective.

2. Divide and conquer strategy

We are familiar with how British used this strategy to conquer India. The idea behind divide and conquer is to break a large task into smaller sub-tasks. Complete the small tasks and combine the results to create a whole solution for the original task.

Consider writing a large book for example that may take months or even years to complete. When you think about the humongous task of writing hundreds of pages ahead of you, your brain may freeze! When we analyze too much on how the task can be accomplished, it can result in “analysis paralysis”. The solution is to use “divide-and-conquer”: break the task into small sub-tasks. Focus only on the sub-task, complete it, then move on to solving the next sub-task. Now, over a period of time, the chapters and content can be “combined” to create a whole book.

Of course, this approach works for deterministic, large and complex problems (many real-world challenges are like that). However, it works effectively for “independent” tasks where the result is clearly defined (examples: writing a book, making a movie, organizing a conference). However, in many cases the problem is non-deterministic where outcome is dependent on external factors. Examples: novel approaches (scientific discoveries), solving legal and compliance issues, building consensus among wide range of stakeholders, finding optimal solution by making right decisions, numerous people involved through voluntary work (like organizing a protest match against a government policy). In such contexts, brute force or divide-and-conquer solutions simply don’t work.

A technical example is a program that plays chess game. Straightforward application of brute force or divide-and-conquer will not be an effective strategy.

Consider starting a services-based start-up. Here the outcome may be an IPO or a successful acquisition. But the path that leads to that result is non-linear and if and when the result can be achieved depends on numerous factors. Examples: having right partners in place, getting right people on board, getting a paying customer, exploiting changing business environments or getting specialisation in niche technologies. Hence, using divide-and-conquer strategy is not an effective idea for building a successful services-based start-up.

3. Dynamic programming

In simple terms, dynamic programming is a technique used for creating optimal solutions: it involves “caching” (i.e., reusing results computed earlier) to come up with the solution. Dynamic programming is a strategy that builds over “divide-and-conquer” – it avoids reusing the sub-solutions. Also, note that dynamic programming is “bottom-up” whereas divide and conquer is “top-down”. Let me explain.

Consider that you are working on mobile app development need to write a book on Android. Let us say you want to write a book on Android. Now, if you have already written articles or blog posts and have created presentations, you can restructure them and write them as chapters. In other words you are “caching” existing sub-solutions instead of creating them from scratch and use them to solve larger problem.

As you can notice, dynamic programming is suitable especially for optimization problems. So, it may be applicable for specific problems that you may want to solve.

4. Greedy approach

The greedy approach focuses on finding locally optimal solutions with the hope that it will result in finding globally optimal solutions.

Let us revisit the example of starting a service-based startup company and make it successful (say, where success is defined as getting acquired or going for an IPO). Greedy approach is best suited for this problem because we need to make locally optimal solutions. Finding suitable co-founders, getting a place for work, getting fresh engineers or inexperienced engineers, finding local customers first and then looking for international clients – all these are examples of finding locally optimal solutions. These locally optimal decisions are all under the hope that they will lead to globally optimal solutions. In this approach, effort, time and money is optimized and it maximizes the chances of success.

Note that there is nothing “greedy” (its the literal meaning) involved in using “greedy algorithm strategy”. It is perhaps one of the most effective strategies we can use for long term success in life.

—-

Of course, these examples are over-simplifications and the real-world problems are more complex and intricate than the descriptions here! For a technical example, writing a program that play chess game and beats Grand Masters is a really really complex task – that calls for advanced strategies.

The key take-away from this article is this: it is possible to apply different strategies for problem solving.

The best strategy to choose depends on the nature of the problem and the context. By explicitly thinking about the strategy we are following, we can evaluate the effectiveness of the approach we are following and make course corrections.