Introduction to Algorithms


Regular visitors must be wondering as to why did we add this new section to the site. Well this post talks of the same. The word 'algorithm' is taken from the arabic word - 'al-khwarizmi', which in ancient time meant, "performing calculations". Precise meaning- Step-by-step process of doing a perticular task by giving definite instructions to machine.

 

Why is it considered as a whole field of study?

 

There are many ways to perform a certain task,but they largely differ on the basis of their performance. For instance, if you are writing an application where you have to search for a keyword in a large database.You can perform a brute-force search for the object instance in the database. But if the database is in terms of millions of elements, this solution stands useless.A better solution would be to use hashing or some data structure which would rapidly retrieve the element and also make rapid updates.Hence,coming up with appropriate algorithms for sub-operations in application development is highly important.

 

How to come up with the correct algorithm for a perticular task?

 

The simple answer to this question is "Practice" and "Patience". Try to see every problem as an optimization problem. Every application you are looking forward to write, think of optimizing it, both time and space wise. A most important aspect of an application is its performance. Scaling your application for, let's say, a problem size of million users, is what makes an application, masterpeice.

 

Is it worth giving a shot, if you haven't have done it before?

 

You might not have given much concern to the optimization of details of the application, but your language, behind the scene, does it for you. For instance, when you keep a vector of the elements in any application, have you ever thought how does the vector grows in size, without giving you any headaches.As the matter of fact, if you would have tried it using an array, you would have to copy all the elements to a new array of larger size(probably double, in which case it is known as table doubling).And not using table doubling at right time, can make your application slow! Very Slow!, but YAY!! java does it for us!! But there would be situations where, the language won't be able to rescue you, and you would have to write an optimized algorithm on your own.

 

What's next-

 

Here is a compilation of some basic algorithms and implementation of some data structures(BONUS)! Learn them, use them to increase your chances of writing optimized solutions. Your applications would scale well.

 

All the best -

 

Share this: