- Time-complexity of old algorithm is $O(htimes w)$
- Time-complexity of new algorithm is $O(h) + O(ntimes m)$
Now my question is : how to express this time complexity optimization in terms of $h$ and $w$ ? is it a real optimization ?
Asked By : ALJI Mohamed
Answered By : babou
is it a real optimization ?
Your optimizations aim at improving performance in your range of applications. Complexity does not measure performance but scalability. A constant multiplicative factor of ten zillions does not change the complexity but has a drastic effect on performance. The matrix multiplication algorithm that have the best complexity are never used because they have abysmal performance. You have to consider huge matrices for them to be any use. Furthermore, raw complexity on arbitrary measure of the size of the problem may have little practical meaning in some cases. The relevant size for some complexity analyses may be the number of occurences of a specific feature of the problem input, rather than the length of the problem in number of symbols. Some exponential algorithms are routinely used without problems because the feature causing the high complexity is actually rarely used, independently of the input size. Your modification of the algorithm may be a real optimization, that may give you an algorithm ten times faster, but this may not show in complexity analysis. This is why it is sometimes useful to do precise cost analysis. But that is more difficult since you must account for the different costs of different elementary operations (which is not required for complexity analysis). A possible way to assess your optimization is benchmarking, rather than tedious theoretical counting. Your question did not say whether you were considering worst case or average complexity. I did not ask because my remarks apply in both cases. Note: The fact that the algorithm has better performance, with the same worst case complexity does not imply that the average complexity was improved.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/44623 Ask a Question Download Related Notes/Documents