Getting Good At Algorithms: Progress Report #4

On contraire to what I wrote previously, being good at algorithms is not just a factor of knowing a lot of good algorithms and just applying them to the right situation. Studying existing algorithms give you ample examples for developing ones’ intuition for coming up with innovative solutions to new problems.

These techniques that have been applied in the design of these algorithms proivde food for thought - a toolset of possible assumptions that can be applied to the problems that we encounter.

Example: Finding the median

The first impulse of everyone who wants to solve a algorithmic problem is - How do I find the right solution? But this is an example where we start off with select a potentiall wrong one and arrive at the right one and end up benefiting in the end.

It is easy to find the median of a set of numbers. You just have to sort the numbers and get the number which is at the middle. But that has time complexity of nlog n. Can we do better? Yes.

If we randomly assume an answer as a starting point and leave it probability.

Getting Good At Algorithms: Progress Report #3

Getting Good At Algorithms: Progress Report #2

What it really means to be good?

Getting good at algorithms boils down to one thing - knowing common tricks to solve problems.

You will face a wide swathe of problems in the big bad world out there. Not all of them will have a clear cut solution.

Coming up with algorithmic solutions is not like solving algebra where there is a clear process to be followed. You cannot follow some procedure to crank out a O(nlogn) solution to any problem.

The ingenious solutions that we currently have mostly come out of nowhere - someone who is spending not lot of their time to solve these specific algorithmic riddles cannot intuit the solution to these problems, such as you when you are in the receiving end of these questions in an interview.

Getting good at algorithms mostly seems to involve knowing as many of these techniques as possible and adapting one or more of them to new problems. But that will only take you so far. That will take you somewhere provided that these problems are developed around the explicit requirement that these specific problems be applied.

Failing that, the only solution that can be applied in a moment's notice is INDEED the one that involves brute force - the one that is the most straightforward one. Spending some time on the problem may open up opportunities to apply one of these algorithms or techniques to the problem at hand. But that may or may not happen.