Wednesday, 29 December 2010

The need of an Algorithm

Algorithms is a mathematical term and is studied part of mathematics in classic college syllabus. But now, the trend has changed algorithms to a computer science related one. However, Algorithms can fit in any domain you can think about. Algorithm is a mathematical and analytical subject that every science discipline should know about to solve any real world problem efficiently. Many day-to-day problems involve numerous algorithms like sorting, searching, plotting etc. So, there is always a need for algorithms. Generally, algorithms are designed to be faster with less resource consumption. There are many algorithms already available and the domain on which they operate is important. For a cook, an algorithm may take just receipes as input and output is the yummy food. The process in which the mixture of receipes is done is the algorithm for him. For computers, just the input and output forms change. :) You can even reuse computer algorithms for almost anything. With robotics & AI being the future, algorithms are going beyond anything that can be measured in a cooking receipe scale. :) There are algorithms which don't obey neither the input nor the ouput in a deterministic way and work completely in a randomized, unpredictable ways. But like how fusion is controlled in a nuclear reactor, algorithms are made predictable to some extend. Best quote for a nuclear blast of an algorithm would be "Welcome to the Matrix World!!". :) But for every type of algorithms, these are the common properties,
  1. Less resource usage
  2. Faster execution
  3. Reusability
  4. Accept large Input and produce correct ouput
These can be disobeyed when a problem is non-deterministic. So, don't memorize this. :) There is some mathematics involved in calculating deterministically the metrics. 1, 2 & 4 can be represented using big-Oh notation. Only for the 3rd property, where the software engineering comes in, which is easily understandable by any programmer who writes code once in his life. :) Big-Oh is nothing but a mathematical function which represents a graph plot, with input size in x-axis and resource usage or executation speed in y-axis. This Big-Oh is also called as Space/Time complexity. Usually, this is calculated and recorded as a benchmark for an algorithm. I will explain about this in future rather than at the start. :) Note that, this Big-Oh notation can be used for any type of algorithms. Not just for computer algorithms. :) Mathematics is a general subject you know.. :P The articles will discuss about algorithms from scratch. And all articles will be readable by Dummies since it is written by Dummies, for the Dummies and dedicated to the Dummies.