2014年3月30日 星期日

Algorithm and Efficiency

    We've been learning the efficiency of different algorithms. A good algorithm will have a high efficiency which takes less computer memory and time to process it. Therefore, it is important to understand different algorithms and how to estimate the efficiency (run-time) of functions.

    So far we have learned a few sorting algorithms: insertion, selection, bubble, quick, merge. These sorting methods has different efficiency. Although some of them have the same efficiency on the worst case, it does not mean that they have exactly the same run-time. The Big-O notation ignores the constants, so that, although you might see that they have the same Big-O, it doe not mean that they have the same efficiency. For instance, insertion sort and selection sort have the same efficiency on the worst case. However, we can still find that insertion sort is faster than selection sort if we test them precisely.

沒有留言:

張貼留言