|
Algorithm Optimization is Important |
|
|
Most of the software engineers at first write down the algorithm and then implement it into Pascal, C or FORTRAN environment. They always need the fastest algorithm so the problem can be solved in short time. Below you will find a comparison about how a little assignment difference can make big changes.
Suppose there is an array. We want to find the biggest element of the array. First consider Algorithm 1 and how it works. Then look at Algorithm 2. Can you see the difference? Algorithm 1  Algorithm 1 
Above algorithms are compiled and tested in Turbo C/C++. CPU: CELERON 500 MHz. Results 



Conclusion Algorithm optimization is really important. Every programmer should do that. Array size is 100. 16 million times repeated. The difference is 35 – 26 = 9 seconds.
|